From numpy-svn at scipy.org Wed Oct 1 11:04:11 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 1 Oct 2008 10:04:11 -0500 (CDT) Subject: [Numpy-svn] r5884 - branches Message-ID: <20081001150411.22A2239C249@scipy.org> Author: charris Date: 2008-10-01 10:04:08 -0500 (Wed, 01 Oct 2008) New Revision: 5884 Added: branches/ufunc_cleanup/ Log: Create branch for merging loop cleanups to trunk. Copied: branches/ufunc_cleanup (from rev 5883, trunk) From numpy-svn at scipy.org Wed Oct 1 13:16:09 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 1 Oct 2008 12:16:09 -0500 (CDT) Subject: [Numpy-svn] r5885 - in branches/ufunc_cleanup/numpy: core/src distutils Message-ID: <20081001171609.68A5739C249@scipy.org> Author: charris Date: 2008-10-01 12:16:05 -0500 (Wed, 01 Oct 2008) New Revision: 5885 Modified: branches/ufunc_cleanup/numpy/core/src/arraytypes.inc.src branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src branches/ufunc_cleanup/numpy/distutils/conv_template.py Log: Change conv_template.py to work with continuation lines. Clarify repeated substitution in arraytypes.inc.src. Cleanup ufunc loops. Modified: branches/ufunc_cleanup/numpy/core/src/arraytypes.inc.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/arraytypes.inc.src 2008-10-01 15:04:08 UTC (rev 5884) +++ branches/ufunc_cleanup/numpy/core/src/arraytypes.inc.src 2008-10-01 17:16:05 UTC (rev 5885) @@ -664,7 +664,7 @@ #from=BYTE*13,UBYTE*13,SHORT*13,USHORT*13,INT*13,UINT*13,LONG*13,ULONG*13,LONGLONG*13,ULONGLONG*13,FLOAT*13,DOUBLE*13,LONGDOUBLE*13,CFLOAT*13,CDOUBLE*13,CLONGDOUBLE*13# #totyp=(byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*16# #fromtyp=byte*13, ubyte*13, short*13, ushort*13, int*13, uint*13, long*13, ulong*13, longlong*13, ulonglong*13, float*13, double*13, longdouble*13, float*13, double*13, longdouble*13# -#incr= ip++*169,ip+=2*39# +#incr= (ip++)*169,(ip+=2)*39# */ static void @from at _to_@to@(register @fromtyp@ *ip, register @totyp@ *op, register intp n, Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-01 15:04:08 UTC (rev 5884) +++ branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-01 17:16:05 UTC (rev 5885) @@ -1,6 +1,10 @@ /* -*- c -*- */ /* + * vim:syntax=c + */ + +/* ***************************************************************************** ** INCLUDES ** ***************************************************************************** @@ -13,24 +17,47 @@ #include "config.h" #include +#ifndef M_PI +#define M_PI 3.14159265358979323846264338328 +#endif + /* ***************************************************************************** ** BASIC MATH FUNCTIONS ** ***************************************************************************** */ -/* A whole slew of basic math functions are provided originally - by Konrad Hinsen. */ +float degreesf(float x) { + return x * (float)(180.0/M_PI); +} +double degrees(double x) { + return x * (180.0/M_PI); +} +longdouble degreesl(longdouble x) { + return x * (180.0L/M_PI); +} +float radiansf(float x) { + return x * (float)(M_PI/180.0); +} +double radians(double x) { + return x * (M_PI/180.0); +} +longdouble radiansl(longdouble x) { + return x * (M_PI/180.0L); +} + +/* + * A whole slew of basic math functions are provided originally + * by Konrad Hinsen. + */ + #if !defined(__STDC__) && !defined(_MSC_VER) extern double fmod (double, double); extern double frexp (double, int *); extern double ldexp (double, int); extern double modf (double, double *); #endif -#ifndef M_PI -#define M_PI 3.14159265358979323846264338328 -#endif #if defined(DISTUTILS_USE_SDK) @@ -443,26 +470,6 @@ #define isfinitef(x) (!(isinff((x)) || isnanf((x)))) #define isfinitel(x) (!(isinfl((x)) || isnanl((x)))) -float degreesf(float x) { - return x * (float)(180.0/M_PI); -} -double degrees(double x) { - return x * (180.0/M_PI); -} -longdouble degreesl(longdouble x) { - return x * (180.0L/M_PI); -} - -float radiansf(float x) { - return x * (float)(M_PI/180.0); -} -double radians(double x) { - return x * (M_PI/180.0); -} -longdouble radiansl(longdouble x) { - return x * (M_PI/180.0L); -} - /* First, the C functions that do the real work */ /* if C99 extensions not available then define dummy functions that use the @@ -624,7 +631,62 @@ } #endif +/* + ***************************************************************************** + ** PYTHON OBJECT FUNCTIONS ** + ***************************************************************************** + */ +static PyObject * +Py_square(PyObject *o) +{ + return PyNumber_Multiply(o, o); +} + +static PyObject * +Py_get_one(PyObject *o) +{ + return PyInt_FromLong(1); +} + +static PyObject * +Py_reciprocal(PyObject *o) +{ + PyObject *one = PyInt_FromLong(1); + PyObject *result; + + if (!one) { + return NULL; + } + result = PyNumber_Divide(one, o); + Py_DECREF(one); + return result; +} + +/**begin repeat + * #Kind = Max, Min# + * #OP = >=, <=# + */ +static PyObject * +_npy_Object at Kind@(PyObject *i1, PyObject *i2) +{ + PyObject *result; + int cmp; + + if (PyObject_Cmp(i1, i2, &cmp) < 0) { + return NULL; + } + if (cmp @OP@ 0) { + result = i1; + } + else { + result = i2; + } + Py_INCREF(result); + return result; +} +/**end repeat**/ + /* ***************************************************************************** ** COMPLEX FUNCTIONS ** @@ -632,11 +694,12 @@ */ -/* Don't pass structures between functions (only pointers) because how - structures are passed is compiler dependent and could cause - segfaults if ufuncobject.c is compiled with a different compiler - than an extension that makes use of the UFUNC API -*/ +/* + * Don't pass structures between functions (only pointers) because how + * structures are passed is compiler dependent and could cause + * segfaults if ufuncobject.c is compiled with a different compiler + * than an extension that makes use of the UFUNC API + */ /**begin repeat @@ -650,10 +713,11 @@ static c at typ@ nc_i at c@ = {0., 1.}; static c at typ@ nc_i2 at c@ = {0., 0.5}; /* - static c at typ@ nc_mi at c@ = {0., -1.}; - static c at typ@ nc_pi2 at c@ = {M_PI/2., 0.}; -*/ + * static c at typ@ nc_mi at c@ = {0., -1.}; + * static c at typ@ nc_pi2 at c@ = {M_PI/2., 0.}; + */ + static void nc_sum at c@(c at typ@ *a, c at typ@ *b, c at typ@ *r) { @@ -681,7 +745,7 @@ static void nc_prod at c@(c at typ@ *a, c at typ@ *b, c at typ@ *r) { - register @typ@ ar=a->real, br=b->real, ai=a->imag, bi=b->imag; + @typ@ ar=a->real, br=b->real, ai=a->imag, bi=b->imag; r->real = ar*br - ai*bi; r->imag = ar*bi + ai*br; return; @@ -691,8 +755,8 @@ nc_quot at c@(c at typ@ *a, c at typ@ *b, c at typ@ *r) { - register @typ@ ar=a->real, br=b->real, ai=a->imag, bi=b->imag; - register @typ@ d = br*br + bi*bi; + @typ@ ar=a->real, br=b->real, ai=a->imag, bi=b->imag; + @typ@ d = br*br + bi*bi; r->real = (ar*br + ai*bi)/d; r->imag = (ai*br - ar*bi)/d; return; @@ -801,8 +865,10 @@ return; } } - /* complexobect.c uses an inline version of this formula - investigate whether this had better performance or accuracy */ + /* + * complexobect.c uses an inline version of this formula + * investigate whether this had better performance or accuracy + */ nc_log at c@(a, r); nc_prod at c@(r, b, r); nc_exp at c@(r, r); @@ -823,6 +889,10 @@ static void nc_acos at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_neg(nc_prodi(nc_log(nc_sum(x,nc_prod(nc_i, + * nc_sqrt(nc_diff(nc_1,nc_prod(x,x)))))))); + */ nc_prod at c@(x,x,r); nc_diff at c@(&nc_1 at c@, r, r); nc_sqrt at c@(r, r); @@ -832,14 +902,15 @@ nc_prodi at c@(r, r); nc_neg at c@(r, r); return; - /* return nc_neg(nc_prodi(nc_log(nc_sum(x,nc_prod(nc_i, - nc_sqrt(nc_diff(nc_1,nc_prod(x,x)))))))); - */ } static void nc_acosh at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_log(nc_sum(x, + * nc_prod(nc_sqrt(nc_sum(x,nc_1)), nc_sqrt(nc_diff(x,nc_1))))); + */ c at typ@ t; nc_sum at c@(x, &nc_1 at c@, &t); @@ -850,15 +921,15 @@ nc_sum at c@(x, r, r); nc_log at c@(r, r); return; - /* - return nc_log(nc_sum(x, - nc_prod(nc_sqrt(nc_sum(x,nc_1)), nc_sqrt(nc_diff(x,nc_1))))); - */ } static void nc_asin at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_neg(nc_prodi(nc_log(nc_sum(nc_prod(nc_i,x), + * nc_sqrt(nc_diff(nc_1,nc_prod(x,x))))))); + */ c at typ@ a, *pa=&a; nc_prod at c@(x, x, r); nc_diff at c@(&nc_1 at c@, r, r); @@ -869,30 +940,29 @@ nc_prodi at c@(r, r); nc_neg at c@(r, r); return; - /* - return nc_neg(nc_prodi(nc_log(nc_sum(nc_prod(nc_i,x), - nc_sqrt(nc_diff(nc_1,nc_prod(x,x))))))); - */ } static void nc_asinh at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_log(nc_sum(nc_sqrt(nc_sum(nc_1,nc_prod(x,x))),x)); + */ nc_prod at c@(x, x, r); nc_sum at c@(&nc_1 at c@, r, r); nc_sqrt at c@(r, r); nc_sum at c@(r, x, r); nc_log at c@(r, r); return; - /* - return nc_log(nc_sum(nc_sqrt(nc_sum(nc_1,nc_prod(x,x))),x)); - */ } static void nc_atan at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_prod(nc_i2,nc_log(nc_quot(nc_sum(nc_i,x),nc_diff(nc_i,x)))); + */ c at typ@ a, *pa=&a; nc_diff at c@(&nc_i at c@, x, pa); nc_sum at c@(&nc_i at c@, x, r); @@ -900,14 +970,14 @@ nc_log at c@(r,r); nc_prod at c@(&nc_i2 at c@, r, r); return; - /* - return nc_prod(nc_i2,nc_log(nc_quot(nc_sum(nc_i,x),nc_diff(nc_i,x)))); - */ } static void nc_atanh at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_prod(nc_half,nc_log(nc_quot(nc_sum(nc_1,x),nc_diff(nc_1,x)))); + */ c at typ@ a, *pa=&a; nc_diff at c@(&nc_1 at c@, x, r); nc_sum at c@(&nc_1 at c@, x, pa); @@ -915,9 +985,6 @@ nc_log at c@(r, r); nc_prod at c@(&nc_half at c@, r, r); return; - /* - return nc_prod(nc_half,nc_log(nc_quot(nc_sum(nc_1,x),nc_diff(nc_1,x)))); - */ } static void @@ -1018,1139 +1085,975 @@ ***************************************************************************** */ +#define OUTPUT_LOOP\ + char *op = args[1];\ + intp os = steps[1];\ + intp n = dimensions[0];\ + intp i;\ + for(i = 0; i < n; i++, op += os) -/**begin repeat +#define UNARY_LOOP\ + char *ip1 = args[0], *op = args[1];\ + intp is1 = steps[0], os = steps[1];\ + intp n = dimensions[0];\ + intp i;\ + for(i = 0; i < n; i++, ip1 += is1, op += os) - #TYPE=(BOOL, BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE)*2# - #OP=||, +*13, ^, -*13# - #kind=add*14, subtract*14# - #typ=(Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*2# -*/ +#define UNARY_LOOP_TWO_OUT\ + char *ip1 = args[0], *op1 = args[1], *op2 = args[2];\ + intp is1 = steps[0], os1 = steps[1], os2 = steps[2];\ + intp n = dimensions[0];\ + intp i;\ + for(i = 0; i < n; i++, ip1 += is1, op1 += os1, op2 += os2) -static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) -{ - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i, >=, <, <=, &&, ||# + **/ + static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i, <# + **/ static void - at TYP@_multiply(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0], is2=steps[1], os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for (i=0; ireal, \ - ai=((c at typ@ *)i1)->imag, \ - br=((c at typ@ *)i2)->real, \ - bi=((c at typ@ *)i2)->imag; - ((c at typ@ *)op)->real = ar*br - ai*bi; - ((c at typ@ *)op)->imag = ar*bi + ai*br; + UNARY_LOOP { + Bool in1 = *(Bool *)ip1; + *((Bool *)op) = in1 @OP@ 0; } } +/**end repeat**/ static void - at TYP@_divide(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ones_like(char **args, intp *dimensions, intp *steps, void *data) { - register intp i; - intp is1=steps[0], is2=steps[1], os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for (i=0; ireal, \ - ai=((c at typ@ *)i1)->imag, \ - br=((c at typ@ *)i2)->real, \ - bi=((c at typ@ *)i2)->imag; - register @typ@ d = br*br + bi*bi; - ((c at typ@ *)op)->real = (ar*br + ai*bi)/d; - ((c at typ@ *)op)->imag = (ai*br - ar*bi)/d; + OUTPUT_LOOP { + *((Bool *)op) = 1; } } + +/* + ***************************************************************************** + ** INTEGER LOOPS + ***************************************************************************** + */ + +/**begin repeat + * #type = byte, short, int, long, longlong# + * #TYPE = BYTE, SHORT, INT, LONG, LONGLONG# + * #ftype = float, float, double, double, double# + */ + +/**begin repeat1 + * both signed and unsigned integer types + * #s = , u# + * #S = , U# + */ + +#define @S@@TYPE at _floor_divide @S@@TYPE at _divide + static void - at TYP@_floor_divide(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *data) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2],n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; ireal, \ - ai=((c at typ@ *)i1)->imag, \ - br=((c at typ@ *)i2)->real, \ - bi=((c at typ@ *)i2)->imag; - register @typ@ d = br*br + bi*bi; - ((c at typ@ *)op)->real = floor at c@((ar*br + ai*bi)/d); - ((c at typ@ *)op)->imag = 0; + OUTPUT_LOOP { + *((@s@@type@ *)op) = 1; } } -#define @TYP at _true_divide @TYP at _divide -/**end repeat**/ - - -/**begin repeat - #TYP=UBYTE,USHORT,UINT,ULONG,ULONGLONG# - #typ=ubyte, ushort, uint, ulong, ulonglong# -*/ static void - at TYP@_divide(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _square(char **args, intp *dimensions, intp *steps, void *data) { - register intp i, is1=steps[0],is2=steps[1],os=steps[2],n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i 0) != (y > 0)) && (x % y != 0)) tmp--; - *((@typ@ *)op)= tmp; - } + UNARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + *((@s@@type@ *)op) = 1.0/in1; } } -/**end repeat**/ - -/**begin repeat - #TYP=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG# - #typ=char, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong# - #otyp=float*4, double*6# -*/ static void - at TYP@_true_divide(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _conjugate(char **args, intp *dimensions, intp *steps, void *func) { - register intp i, is1=steps[0],is2=steps[1],os=steps[2],n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i># + */ static void - at TYP@_square(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - intp i, is1 = steps[0], os = steps[1], n = dimensions[0]; - char *i1 = args[0], *op = args[1]; - c at typ@ *x, *y; - @typ@ xr, xi; - - for (i = 0; i < n; i++, i1 += is1, op += os) { - x = (c at typ@ *)i1; - y = (c at typ@ *)op; - xr = x->real; - xi = x->imag; - y->real = xr*xr - xi*xi; - y->imag = 2*xr*xi; + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + *((@s@@type@ *)op) = in1 @OP@ in2; } } -/**end repeat**/ +/**end repeat2**/ -static PyObject * -Py_square(PyObject *o) +/**begin repeat2 + * #kind = equal, not_equal, greater, greater_equal, less, less_equal, + * logical_and, logical_or# + * #OP = ==, !=, >, >=, <, <=, &&, ||# + */ +static void + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - return PyNumber_Multiply(o, o); + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + *((Bool *)op) = in1 @OP@ in2; + } } +/**end repeat2**/ - -/**begin repeat - #TYP=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE# - #typ=char, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble# -*/ static void - at TYP@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _logical_xor(char **args, intp *dimensions, intp *steps, void *func) { - intp i, is1 = steps[0], os = steps[1], n = dimensions[0]; - char *i1 = args[0], *op = args[1]; - - for (i = 0; i < n; i++, i1 += is1, op += os) { - @typ@ x = *((@typ@ *)i1); - *((@typ@ *)op) = (@typ@) (1.0 / x); + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + *((Bool *)op)= (in1 && !in2) || (!in1 && in2); } } -/**end repeat**/ -/**begin repeat - #TYP=CFLOAT,CDOUBLE,CLONGDOUBLE# - #typ=float, double, longdouble# -*/ +/**begin repeat2 + * #kind = maximum, minimum# + * #OP = >, <# + **/ static void - at TYP@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - intp i, is1 = steps[0], os = steps[1], n = dimensions[0]; - char *i1 = args[0], *op = args[1]; - c at typ@ *x, *y; - @typ@ xr, xi, r, denom; - - for (i = 0; i < n; i++, i1 += is1, op += os) { - x = (c at typ@ *)i1; - y = (c at typ@ *)op; - xr = x->real; - xi = x->imag; - if (fabs(xi) <= fabs(xr)) { - r = xi / xr; - denom = xr + xi * r; - y->real = 1 / denom; - y->imag = -r / denom; - } else { - r = xr / xi; - denom = xr * r + xi; - y->real = r / denom; - y->imag = -1 / denom; - } + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + *((@s@@type@ *)op) = (in1 @OP@ in2) ? in1 : in2; } } -/**end repeat**/ +/**end repeat2**/ - -static PyObject * -Py_reciprocal(PyObject *o) +static void + at S@@TYPE at _true_divide(char **args, intp *dimensions, intp *steps, void *func) { - PyObject *one, *result; - one = PyInt_FromLong(1); - if (!one) return NULL; - result = PyNumber_Divide(one, o); - Py_DECREF(one); - return result; + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + if (in2 == 0) { + generate_divbyzero_error(); + *((@ftype@ *)op) = 0; + } + else { + *((@ftype@ *)op) = (@ftype@)in1 / (@ftype@)in2; + } + } } -static PyObject * -_npy_ObjectMax(PyObject *i1, PyObject *i2) +static void + at S@@TYPE at _power(char **args, intp *dimensions, intp *steps, void *func) { - int cmp; - PyObject *res; - if (PyObject_Cmp(i1, i2, &cmp) < 0) return NULL; - - if (cmp >= 0) { - res = i1; + BINARY_LOOP { + const @ftype@ in1 = (@ftype@)*(@s@@type@ *)ip1; + const @ftype@ in2 = (@ftype@)*(@s@@type@ *)ip2; + *((@s@@type@ *)op) = (@s@@type@) pow(in1, in2); } - else { - res = i2; - } - Py_INCREF(res); - return res; } -static PyObject * -_npy_ObjectMin(PyObject *i1, PyObject *i2) +static void + at S@@TYPE at _fmod(char **args, intp *dimensions, intp *steps, void *func) { - int cmp; - PyObject *res; - if (PyObject_Cmp(i1, i2, &cmp) < 0) return NULL; + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + if (in2 == 0) { + generate_divbyzero_error(); + *((@s@@type@ *)op) = 0; + } + else { + *((@s@@type@ *)op)= in1 % in2; + } - if (cmp <= 0) { - res = i1; } - else { - res = i2; - } - Py_INCREF(res); - return res; } -/* ones_like is defined here because it's used for x**0 */ +/**end repeat1**/ -/**begin repeat - #TYP=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE# - #typ=char, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble# -*/ static void - at TYP@_ones_like(char **args, intp *dimensions, intp *steps, void *data) +U at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) { - intp i, os = steps[1], n = dimensions[0]; - char *op = args[1]; - - for (i = 0; i < n; i++, op += os) { - *((@typ@ *)op) = 1; + UNARY_LOOP { + const u at type@ in1 = *(u at type@ *)ip1; + *((u at type@ *)op) = in1; } } -/**end repeat**/ -/**begin repeat - #TYP=CFLOAT,CDOUBLE,CLONGDOUBLE# - #typ=float, double, longdouble# -*/ static void - at TYP@_ones_like(char **args, intp *dimensions, intp *steps, void *data) + at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) { - intp i, is1 = steps[0], os = steps[1], n = dimensions[0]; - char *i1 = args[0], *op = args[1]; - c at typ@ *y; - - for (i = 0; i < n; i++, i1 += is1, op += os) { - y = (c at typ@ *)op; - y->real = 1.0; - y->imag = 0.0; + UNARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + *((@type@ *)op) = (in1 >= 0) ? in1 : -in1; } } -/**end repeat**/ -static PyObject * -Py_get_one(PyObject *o) +static void +U at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) { - return PyInt_FromLong(1); + UNARY_LOOP { + const u at type@ in1 = *(u at type@ *)ip1; + *((u at type@ *)op) = in1 > 0 ? 1 : 0; + } } - -/**begin repeat - #TYP=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG# - #typ=char, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong# - #btyp=float*4, double*6# -*/ static void - at TYP@_power(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) { - register intp i, is1=steps[0],is2=steps[1]; - register intp os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - @btyp@ x, y; + UNARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + *((@type@ *)op) = in1 > 0 ? 1 : (in1 < 0 ? -1 : 0); + } +} - for(i=0; i 0) != (in2 > 0)) && (in1 % in2 != 0)) { + *((@type@ *)op) = in1/in2 - 1; + } + else { + *((@type@ *)op) = in1/in2; + } } } -/**end repeat**/ -/**begin repeat - #TYP=UBYTE, BYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE# - #typ=ubyte, char, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble# -*/ static void - at TYP@_conjugate(char **args, intp *dimensions, intp *steps, void *func) +U at TYPE@_divide(char **args, intp *dimensions, intp *steps, void *func) { - register intp i, is1=steps[0], os=steps[1], n=dimensions[0]; - char *i1=args[0], *op=args[1]; - for(i=0; i 0) == (in2 > 0) || rem == 0) { + *((@type@ *)op) = rem; + } + else { + *((@type@ *)op) = rem + in2; + } + } + } +} - for(i=0; i, >=, &&, ||# + */ static void - at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i, n; - intp is1=steps[0], os=steps[1]; - char *i1=args[0], *op=args[1]; - - n=dimensions[0]; - for(i=0; i, >=, <, <=, ==, !=, &&, ||, &, |, ^# -**/ static void -BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_logical_not(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - Bool in1, in2; - for(i=0; i*13, >=*13, <*13, <=*13# - #typ=(byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*4# - #kind= greater*13, greater_equal*13, less*13, less_equal*13# -*/ - +/**begin repeat1 + * #kind = isnan, isinf, isfinite, signbit# + * #func = isnan, isinf, isfinite, signbit# + **/ static void @TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i*3, >=*3, <*3, <=*3# - #typ=(cfloat, cdouble, clongdouble)*4# - #kind= greater*3, greater_equal*3, less*3, less_equal*3# -*/ - +/**begin repeat1 + * #kind = maximum, minimum# + * #OP = >, <# + **/ static void @TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; ireal == ((@typ@ *)i2)->real) - *((Bool *)op)=((@typ@ *)i1)->imag @OP@ \ - ((@typ@ *)i2)->imag; - else - *((Bool *)op)=((@typ@ *)i1)->real @OP@ \ - ((@typ@ *)i2)->real; + /* */ + BINARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + const @type@ in2 = *(@type@ *)ip2; + *((@type@ *)op) = in1 @OP@ in2 ? in1 : in2; } } -/**end repeat**/ +/**end repeat1**/ +static void + at TYPE@_floor_divide(char **args, intp *dimensions, intp *steps, void *func) +{ + BINARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + const @type@ in2 = *(@type@ *)ip2; + *((@type@ *)op) = floor at c@(in1/in2); + } +} -/**begin repeat - #TYPE=(BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE)*4# - #typ=(byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*4# - #OP= ==*13, !=*13, &&*13, ||*13# - #kind=equal*13, not_equal*13, logical_and*13, logical_or*13# -*/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i 0) ? in1 : -in1; + /* add 0 to clear -0.0 */ + *((@type@ *)op) = tmp + 0; } } -/**end repeat**/ -#define BOOL_negative BOOL_logical_not - -#define _SIGN1(x) ((x) > 0 ? 1 : ((x) < 0 ? -1 : 0)) -#define _SIGN2(x) ((x) == 0 ? 0 : 1) -#define _SIGNC(x) (((x).real > 0) ? 1 : ((x).real < 0 ? -1 : ((x).imag > 0 ? 1 : ((x).imag < 0) ? -1 : 0))) -/**begin repeat - #TYPE=BYTE,SHORT,INT,LONG,LONGLONG,FLOAT,DOUBLE,LONGDOUBLE,UBYTE,USHORT,UINT,ULONG,ULONGLONG# - #typ=byte,short,int,long,longlong,float,double,longdouble,ubyte,ushort,uint,ulong,ulonglong# - #func=_SIGN1*8,_SIGN2*5# -*/ static void - at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_negative(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],os=steps[1], n=dimensions[0]; - char *i1=args[0], *op=args[1]; - @typ@ t1; - for(i=0; i 0) { + *((@type@ *)op) = 1; + } + else if (in1 < 0) { + *((@type@ *)op) = -1; + } + else { + *((@type@ *)op) = 0; + } } } -/**end repeat**/ -#undef _SIGN1 -#undef _SIGN2 -#undef _SIGNC - - static void -OBJECT_sign(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_modf(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],os=steps[1], n=dimensions[0]; - char *i1=args[0], *op=args[1]; - PyObject *t1, *zero, *res; - zero = PyInt_FromLong(0); - for(i=0; ireal || \ - ((@typ@ *)i1)->imag); + BINARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + const int in2 = *(int *)ip2; + *(@type@ *)op = ldexp at c@(in1, in2); } } -/**end repeat**/ +#endif +#undef HAVE_DOUBLE_FUNCS +#define @TYPE at _true_divide @TYPE at _divide +/**end repeat**/ +/* + ***************************************************************************** + ** COMPLEX LOOPS ** + ***************************************************************************** + */ + /**begin repeat - #TYPE=BYTE,SHORT,INT,LONG,LONGLONG# - #typ=byte, short, int, long, longlong# - #c=f*2,,,l*1# -*/ + * complex types + * #ctype= cfloat, cdouble, clongdouble# + * #CTYPE= CFLOAT, CDOUBLE, CLONGDOUBLE# + * #type = float, double, longdouble# + * #c = f, , l# + */ + +/**begin repeat1 + * arithmetic + * #kind = add, subtract# + * #OP = +, -# + */ static void - at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - register @typ@ ix,iy, tmp; - for(i=0; i 0) == (iy > 0)) { - *((@typ@ *)op) = ix % iy; - } - else { /* handle mixed case the way Python does */ - tmp = ix % iy; - if (tmp) tmp += iy; - *((@typ@ *)op)= tmp; - } + BINARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + const @type@ in2r = ((@type@ *)ip2)[0]; + const @type@ in2i = ((@type@ *)ip2)[1]; + ((@type@ *)op)[0] = in1r @OP@ in2r; + ((@type@ *)op)[1] = in1i @OP@ in2i; } } -/**end repeat**/ +/**end repeat1**/ -/**begin repeat - #TYPE=UBYTE,USHORT,UINT,ULONG,ULONGLONG# - #typ=ubyte, ushort, uint, ulong, ulonglong# -*/ static void - at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_multiply(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - register @typ@ ix,iy; - for(i=0; i, >=, <, <=# + */ +static void + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +{ + BINARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + const @type@ in2r = ((@type@ *)ip2)[0]; + const @type@ in2i = ((@type@ *)ip2)[1]; + if (in1r != in2r) { + *((Bool *)op) = in1r @OP@ in2r ? 1 : 0; } else { - *((@typ@ *)op)= x % y; + *((Bool *)op) = in1i @OP@ in2i ? 1 : 0; } - } } -/**end repeat**/ +/**end repeat1**/ -/**begin repeat - - #TYPE=(BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG)*5# - #typ=(byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong)*5# - #OP= &*10, |*10, ^*10, <<*10, >>*10# - #kind=bitwise_and*10, bitwise_or*10, bitwise_xor*10, left_shift*10, right_shift*10# - +/**begin repeat1 + #kind = logical_and, logical_or# + #OP1 = ||, ||# + #OP2 = &&, ||# */ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - register char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; ireal || ((@typ@ *)i1)->imag; - p2 = ((@typ@ *)i2)->real || ((@typ@ *)i2)->imag; - *((Bool *)op)= (p1 || p2) && !(p1 && p2); + UNARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + ((@type@ *)op)[0] = in1r*in1r - in1i*in1i; + ((@type@ *)op)[1] = in1r*in1i + in1i*in1r; } } -/**end repeat**/ - - -/**begin repeat - - #TYPE=(BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE)*2# - #OP= >*14, <*14# - #typ=(Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*2# - #kind= maximum*14, minimum*14# -*/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i*3, <*3# - #typ=(cfloat, cdouble, clongdouble)*2# - #kind= maximum*3, minimum*3# -*/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ones_like(char **args, intp *dimensions, intp *steps, void *data) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - @typ@ *i1c, *i2c; - for(i=0; ireal @OP@ i2c->real) || \ - ((i1c->real==i2c->real) && (i1c->imag @OP@ i2c->imag))) - memmove(op, i1, sizeof(@typ@)); - else - memmove(op, i2, sizeof(@typ@)); + OUTPUT_LOOP { + ((@type@ *)op)[0] = 1; + ((@type@ *)op)[1] = 0; } } -/**end repeat**/ +static void + at CTYPE@_conjugate(char **args, intp *dimensions, intp *steps, void *func) { + UNARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + ((@type@ *)op)[0] = in1r; + ((@type@ *)op)[1] = -in1i; + } +} - -/*** isinf, isinf, isfinite, signbit ***/ -/**begin repeat - #kind=isnan*3, isinf*3, isfinite*3, signbit*3# - #TYPE=(FLOAT, DOUBLE, LONGDOUBLE)*4# - #typ=(float, double, longdouble)*4# - #c=(f,,l)*4# -*/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is=steps[0], os=steps[1], n=dimensions[0]; - char *ip=args[0], *op=args[1]; - for(i=0; i 0) { + ((@type@ *)op)[0] = 1; + } + else if (in1r < 0) { + ((@type@ *)op)[0] = -1; + } + else { + if (in1i > 0) { + ((@type@ *)op)[0] = 1; + } + else if (in1i < 0) { + ((@type@ *)op)[0] = -1; + } + else { + ((@type@ *)op)[0] = 0; + } + } + ((@type@ *)op)[1] = 0; } } -/**end repeat**/ - - - -/****** modf ****/ - -/**begin repeat - #TYPE=FLOAT, DOUBLE, LONGDOUBLE# - #typ=float, double, longdouble# - #c=f,,l# -*/ +/**begin repeat1 + * #kind = maximum, minimum# + * #OP = >, <# + */ static void - at TYPE@_modf(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],os1=steps[1],os2=steps[2],n=dimensions[0]; - char *i1=args[0], *op1=args[1], *op2=args[2]; - @typ@ x1, y1, y2; - for (i=0; i Author: charris Date: 2008-10-01 13:05:29 -0500 (Wed, 01 Oct 2008) New Revision: 5886 Modified: trunk/numpy/distutils/conv_template.py Log: Make some error messages more informative. Improve error handling. Make continuation lines work. Modified: trunk/numpy/distutils/conv_template.py =================================================================== --- trunk/numpy/distutils/conv_template.py 2008-10-01 17:16:05 UTC (rev 5885) +++ trunk/numpy/distutils/conv_template.py 2008-10-01 18:05:29 UTC (rev 5886) @@ -128,19 +128,22 @@ numrep = obj.group(2) return ','.join([torep]*int(numrep)) -parenrep = re.compile(r"[(]([^)]*?)[)]\*(\d+)") +parenrep = re.compile(r"[(]([^)]*)[)]\*(\d+)") plainrep = re.compile(r"([^*]+)\*(\d+)") -def conv(astr): +def parse_values(astr): # replaces all occurrences of '(a,b,c)*4' in astr - # with 'a,b,c,a,b,c,a,b,c,a,b,c'. The result is + # with 'a,b,c,a,b,c,a,b,c,a,b,c'. Empty braces generate + # empty values, i.e., ()*4 yields ',,,'. The result is # split at ',' and a list of values returned. - astr = parenrep.sub(paren_repl,astr) + astr = parenrep.sub(paren_repl, astr) # replaces occurences of xxx*3 with xxx, xxx, xxx astr = ','.join([plainrep.sub(paren_repl,x.strip()) for x in astr.split(',')]) return astr.split(',') -named_re = re.compile(r"#\s*([\w]*)\s*=\s*([^#]*)#") + +stripast = re.compile(r"\n\s*\*?") +named_re = re.compile(r"#\s*(\w*)\s*=([^#]*)#") def parse_loop_header(loophead) : """Find all named replacements in the header @@ -149,23 +152,29 @@ value is the replacement string. """ + # Strip out '\n' and leading '*', if any, in continuation lines. + # This should not effect code previous to this change as + # continuation lines were not allowed. + loophead = stripast.sub("", loophead) # parse out the names and lists of values names = [] reps = named_re.findall(loophead) nsub = None for rep in reps: - name = rep[0].strip() - vals = conv(rep[1]) + name = rep[0] + vals = parse_values(rep[1]) size = len(vals) if nsub is None : nsub = size elif nsub != size : - msg = "Mismatch in number: %s - %s" % (name, vals) + msg = "Mismatch in number of values:\n%s = %s" % (name, vals) raise ValueError, msg names.append((name,vals)) # generate list of dictionaries, one for each template iteration dlist = [] + if nsub is None : + raise ValueError, "No substitution variables found" for i in range(nsub) : tmp = {} for name,vals in names : @@ -183,8 +192,8 @@ try : val = env[name] except KeyError, e : - msg = '%s: %s'%(lineno, e) - raise KeyError, msg + msg = 'line %d: %s'%(line, e) + raise ValueError, msg return val code = [lineno] @@ -203,7 +212,7 @@ try : envlist = parse_loop_header(head) except ValueError, e : - msg = "%s: %s" % (lineno, e) + msg = "line %d: %s" % (newline, e) raise ValueError, msg for newenv in envlist : newenv.update(env) @@ -249,7 +258,10 @@ def process_file(source): lines = resolve_includes(source) sourcefile = os.path.normcase(source).replace("\\","\\\\") - code = process_str(''.join(lines)) + try: + code = process_str(''.join(lines)) + except ValueError, e: + raise ValueError, '"%s", %s' % (sourcefile, e) return '#line 1 "%s"\n%s' % (sourcefile, code) @@ -284,5 +296,8 @@ outfile = open(newname,'w') allstr = fid.read() - writestr = process_str(allstr) + try: + writestr = process_str(allstr) + except ValueError, e: + raise ValueError, "file %s, %s" % (file, e) outfile.write(writestr) From numpy-svn at scipy.org Wed Oct 1 14:06:06 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 1 Oct 2008 13:06:06 -0500 (CDT) Subject: [Numpy-svn] r5887 - trunk/numpy/core/src Message-ID: <20081001180606.DDF5D39C1AE@scipy.org> Author: charris Date: 2008-10-01 13:06:04 -0500 (Wed, 01 Oct 2008) New Revision: 5887 Modified: trunk/numpy/core/src/arraytypes.inc.src Log: Small cleanup to clarify repeated string. Modified: trunk/numpy/core/src/arraytypes.inc.src =================================================================== --- trunk/numpy/core/src/arraytypes.inc.src 2008-10-01 18:05:29 UTC (rev 5886) +++ trunk/numpy/core/src/arraytypes.inc.src 2008-10-01 18:06:04 UTC (rev 5887) @@ -664,7 +664,7 @@ #from=BYTE*13,UBYTE*13,SHORT*13,USHORT*13,INT*13,UINT*13,LONG*13,ULONG*13,LONGLONG*13,ULONGLONG*13,FLOAT*13,DOUBLE*13,LONGDOUBLE*13,CFLOAT*13,CDOUBLE*13,CLONGDOUBLE*13# #totyp=(byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*16# #fromtyp=byte*13, ubyte*13, short*13, ushort*13, int*13, uint*13, long*13, ulong*13, longlong*13, ulonglong*13, float*13, double*13, longdouble*13, float*13, double*13, longdouble*13# -#incr= ip++*169,ip+=2*39# +#incr= (ip++)*169,(ip+=2)*39# */ static void @from at _to_@to@(register @fromtyp@ *ip, register @totyp@ *op, register intp n, From numpy-svn at scipy.org Wed Oct 1 14:08:44 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 1 Oct 2008 13:08:44 -0500 (CDT) Subject: [Numpy-svn] r5888 - trunk/numpy/core/src Message-ID: <20081001180844.15A1339C1AE@scipy.org> Author: charris Date: 2008-10-01 13:08:41 -0500 (Wed, 01 Oct 2008) New Revision: 5888 Modified: trunk/numpy/core/src/umathmodule.c.src Log: Cleanup ufunc loops. At this point loops are separated into variable kinds, so there is a fair amount of duplication. I will probably merge loops that look the same in a later commit. There are no changes to current behavior of loops, this will also be changed in later work to deal with nans and such. Modified: trunk/numpy/core/src/umathmodule.c.src =================================================================== --- trunk/numpy/core/src/umathmodule.c.src 2008-10-01 18:06:04 UTC (rev 5887) +++ trunk/numpy/core/src/umathmodule.c.src 2008-10-01 18:08:41 UTC (rev 5888) @@ -1,6 +1,10 @@ /* -*- c -*- */ /* + * vim:syntax=c + */ + +/* ***************************************************************************** ** INCLUDES ** ***************************************************************************** @@ -13,24 +17,47 @@ #include "config.h" #include +#ifndef M_PI +#define M_PI 3.14159265358979323846264338328 +#endif + /* ***************************************************************************** ** BASIC MATH FUNCTIONS ** ***************************************************************************** */ -/* A whole slew of basic math functions are provided originally - by Konrad Hinsen. */ +float degreesf(float x) { + return x * (float)(180.0/M_PI); +} +double degrees(double x) { + return x * (180.0/M_PI); +} +longdouble degreesl(longdouble x) { + return x * (180.0L/M_PI); +} +float radiansf(float x) { + return x * (float)(M_PI/180.0); +} +double radians(double x) { + return x * (M_PI/180.0); +} +longdouble radiansl(longdouble x) { + return x * (M_PI/180.0L); +} + +/* + * A whole slew of basic math functions are provided originally + * by Konrad Hinsen. + */ + #if !defined(__STDC__) && !defined(_MSC_VER) extern double fmod (double, double); extern double frexp (double, int *); extern double ldexp (double, int); extern double modf (double, double *); #endif -#ifndef M_PI -#define M_PI 3.14159265358979323846264338328 -#endif #if defined(DISTUTILS_USE_SDK) @@ -443,26 +470,6 @@ #define isfinitef(x) (!(isinff((x)) || isnanf((x)))) #define isfinitel(x) (!(isinfl((x)) || isnanl((x)))) -float degreesf(float x) { - return x * (float)(180.0/M_PI); -} -double degrees(double x) { - return x * (180.0/M_PI); -} -longdouble degreesl(longdouble x) { - return x * (180.0L/M_PI); -} - -float radiansf(float x) { - return x * (float)(M_PI/180.0); -} -double radians(double x) { - return x * (M_PI/180.0); -} -longdouble radiansl(longdouble x) { - return x * (M_PI/180.0L); -} - /* First, the C functions that do the real work */ /* if C99 extensions not available then define dummy functions that use the @@ -624,7 +631,62 @@ } #endif +/* + ***************************************************************************** + ** PYTHON OBJECT FUNCTIONS ** + ***************************************************************************** + */ +static PyObject * +Py_square(PyObject *o) +{ + return PyNumber_Multiply(o, o); +} + +static PyObject * +Py_get_one(PyObject *o) +{ + return PyInt_FromLong(1); +} + +static PyObject * +Py_reciprocal(PyObject *o) +{ + PyObject *one = PyInt_FromLong(1); + PyObject *result; + + if (!one) { + return NULL; + } + result = PyNumber_Divide(one, o); + Py_DECREF(one); + return result; +} + +/**begin repeat + * #Kind = Max, Min# + * #OP = >=, <=# + */ +static PyObject * +_npy_Object at Kind@(PyObject *i1, PyObject *i2) +{ + PyObject *result; + int cmp; + + if (PyObject_Cmp(i1, i2, &cmp) < 0) { + return NULL; + } + if (cmp @OP@ 0) { + result = i1; + } + else { + result = i2; + } + Py_INCREF(result); + return result; +} +/**end repeat**/ + /* ***************************************************************************** ** COMPLEX FUNCTIONS ** @@ -632,11 +694,12 @@ */ -/* Don't pass structures between functions (only pointers) because how - structures are passed is compiler dependent and could cause - segfaults if ufuncobject.c is compiled with a different compiler - than an extension that makes use of the UFUNC API -*/ +/* + * Don't pass structures between functions (only pointers) because how + * structures are passed is compiler dependent and could cause + * segfaults if ufuncobject.c is compiled with a different compiler + * than an extension that makes use of the UFUNC API + */ /**begin repeat @@ -650,10 +713,11 @@ static c at typ@ nc_i at c@ = {0., 1.}; static c at typ@ nc_i2 at c@ = {0., 0.5}; /* - static c at typ@ nc_mi at c@ = {0., -1.}; - static c at typ@ nc_pi2 at c@ = {M_PI/2., 0.}; -*/ + * static c at typ@ nc_mi at c@ = {0., -1.}; + * static c at typ@ nc_pi2 at c@ = {M_PI/2., 0.}; + */ + static void nc_sum at c@(c at typ@ *a, c at typ@ *b, c at typ@ *r) { @@ -681,7 +745,7 @@ static void nc_prod at c@(c at typ@ *a, c at typ@ *b, c at typ@ *r) { - register @typ@ ar=a->real, br=b->real, ai=a->imag, bi=b->imag; + @typ@ ar=a->real, br=b->real, ai=a->imag, bi=b->imag; r->real = ar*br - ai*bi; r->imag = ar*bi + ai*br; return; @@ -691,8 +755,8 @@ nc_quot at c@(c at typ@ *a, c at typ@ *b, c at typ@ *r) { - register @typ@ ar=a->real, br=b->real, ai=a->imag, bi=b->imag; - register @typ@ d = br*br + bi*bi; + @typ@ ar=a->real, br=b->real, ai=a->imag, bi=b->imag; + @typ@ d = br*br + bi*bi; r->real = (ar*br + ai*bi)/d; r->imag = (ai*br - ar*bi)/d; return; @@ -801,8 +865,10 @@ return; } } - /* complexobect.c uses an inline version of this formula - investigate whether this had better performance or accuracy */ + /* + * complexobect.c uses an inline version of this formula + * investigate whether this had better performance or accuracy + */ nc_log at c@(a, r); nc_prod at c@(r, b, r); nc_exp at c@(r, r); @@ -823,6 +889,10 @@ static void nc_acos at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_neg(nc_prodi(nc_log(nc_sum(x,nc_prod(nc_i, + * nc_sqrt(nc_diff(nc_1,nc_prod(x,x)))))))); + */ nc_prod at c@(x,x,r); nc_diff at c@(&nc_1 at c@, r, r); nc_sqrt at c@(r, r); @@ -832,14 +902,15 @@ nc_prodi at c@(r, r); nc_neg at c@(r, r); return; - /* return nc_neg(nc_prodi(nc_log(nc_sum(x,nc_prod(nc_i, - nc_sqrt(nc_diff(nc_1,nc_prod(x,x)))))))); - */ } static void nc_acosh at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_log(nc_sum(x, + * nc_prod(nc_sqrt(nc_sum(x,nc_1)), nc_sqrt(nc_diff(x,nc_1))))); + */ c at typ@ t; nc_sum at c@(x, &nc_1 at c@, &t); @@ -850,15 +921,15 @@ nc_sum at c@(x, r, r); nc_log at c@(r, r); return; - /* - return nc_log(nc_sum(x, - nc_prod(nc_sqrt(nc_sum(x,nc_1)), nc_sqrt(nc_diff(x,nc_1))))); - */ } static void nc_asin at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_neg(nc_prodi(nc_log(nc_sum(nc_prod(nc_i,x), + * nc_sqrt(nc_diff(nc_1,nc_prod(x,x))))))); + */ c at typ@ a, *pa=&a; nc_prod at c@(x, x, r); nc_diff at c@(&nc_1 at c@, r, r); @@ -869,30 +940,29 @@ nc_prodi at c@(r, r); nc_neg at c@(r, r); return; - /* - return nc_neg(nc_prodi(nc_log(nc_sum(nc_prod(nc_i,x), - nc_sqrt(nc_diff(nc_1,nc_prod(x,x))))))); - */ } static void nc_asinh at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_log(nc_sum(nc_sqrt(nc_sum(nc_1,nc_prod(x,x))),x)); + */ nc_prod at c@(x, x, r); nc_sum at c@(&nc_1 at c@, r, r); nc_sqrt at c@(r, r); nc_sum at c@(r, x, r); nc_log at c@(r, r); return; - /* - return nc_log(nc_sum(nc_sqrt(nc_sum(nc_1,nc_prod(x,x))),x)); - */ } static void nc_atan at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_prod(nc_i2,nc_log(nc_quot(nc_sum(nc_i,x),nc_diff(nc_i,x)))); + */ c at typ@ a, *pa=&a; nc_diff at c@(&nc_i at c@, x, pa); nc_sum at c@(&nc_i at c@, x, r); @@ -900,14 +970,14 @@ nc_log at c@(r,r); nc_prod at c@(&nc_i2 at c@, r, r); return; - /* - return nc_prod(nc_i2,nc_log(nc_quot(nc_sum(nc_i,x),nc_diff(nc_i,x)))); - */ } static void nc_atanh at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_prod(nc_half,nc_log(nc_quot(nc_sum(nc_1,x),nc_diff(nc_1,x)))); + */ c at typ@ a, *pa=&a; nc_diff at c@(&nc_1 at c@, x, r); nc_sum at c@(&nc_1 at c@, x, pa); @@ -915,9 +985,6 @@ nc_log at c@(r, r); nc_prod at c@(&nc_half at c@, r, r); return; - /* - return nc_prod(nc_half,nc_log(nc_quot(nc_sum(nc_1,x),nc_diff(nc_1,x)))); - */ } static void @@ -1018,1139 +1085,975 @@ ***************************************************************************** */ +#define OUTPUT_LOOP\ + char *op = args[1];\ + intp os = steps[1];\ + intp n = dimensions[0];\ + intp i;\ + for(i = 0; i < n; i++, op += os) -/**begin repeat +#define UNARY_LOOP\ + char *ip1 = args[0], *op = args[1];\ + intp is1 = steps[0], os = steps[1];\ + intp n = dimensions[0];\ + intp i;\ + for(i = 0; i < n; i++, ip1 += is1, op += os) - #TYPE=(BOOL, BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE)*2# - #OP=||, +*13, ^, -*13# - #kind=add*14, subtract*14# - #typ=(Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*2# -*/ +#define UNARY_LOOP_TWO_OUT\ + char *ip1 = args[0], *op1 = args[1], *op2 = args[2];\ + intp is1 = steps[0], os1 = steps[1], os2 = steps[2];\ + intp n = dimensions[0];\ + intp i;\ + for(i = 0; i < n; i++, ip1 += is1, op1 += os1, op2 += os2) -static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) -{ - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i, >=, <, <=, &&, ||# + **/ + static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i, <# + **/ static void - at TYP@_multiply(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0], is2=steps[1], os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for (i=0; ireal, \ - ai=((c at typ@ *)i1)->imag, \ - br=((c at typ@ *)i2)->real, \ - bi=((c at typ@ *)i2)->imag; - ((c at typ@ *)op)->real = ar*br - ai*bi; - ((c at typ@ *)op)->imag = ar*bi + ai*br; + UNARY_LOOP { + Bool in1 = *(Bool *)ip1; + *((Bool *)op) = in1 @OP@ 0; } } +/**end repeat**/ static void - at TYP@_divide(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ones_like(char **args, intp *dimensions, intp *steps, void *data) { - register intp i; - intp is1=steps[0], is2=steps[1], os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for (i=0; ireal, \ - ai=((c at typ@ *)i1)->imag, \ - br=((c at typ@ *)i2)->real, \ - bi=((c at typ@ *)i2)->imag; - register @typ@ d = br*br + bi*bi; - ((c at typ@ *)op)->real = (ar*br + ai*bi)/d; - ((c at typ@ *)op)->imag = (ai*br - ar*bi)/d; + OUTPUT_LOOP { + *((Bool *)op) = 1; } } + +/* + ***************************************************************************** + ** INTEGER LOOPS + ***************************************************************************** + */ + +/**begin repeat + * #type = byte, short, int, long, longlong# + * #TYPE = BYTE, SHORT, INT, LONG, LONGLONG# + * #ftype = float, float, double, double, double# + */ + +/**begin repeat1 + * both signed and unsigned integer types + * #s = , u# + * #S = , U# + */ + +#define @S@@TYPE at _floor_divide @S@@TYPE at _divide + static void - at TYP@_floor_divide(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *data) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2],n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; ireal, \ - ai=((c at typ@ *)i1)->imag, \ - br=((c at typ@ *)i2)->real, \ - bi=((c at typ@ *)i2)->imag; - register @typ@ d = br*br + bi*bi; - ((c at typ@ *)op)->real = floor at c@((ar*br + ai*bi)/d); - ((c at typ@ *)op)->imag = 0; + OUTPUT_LOOP { + *((@s@@type@ *)op) = 1; } } -#define @TYP at _true_divide @TYP at _divide -/**end repeat**/ - - -/**begin repeat - #TYP=UBYTE,USHORT,UINT,ULONG,ULONGLONG# - #typ=ubyte, ushort, uint, ulong, ulonglong# -*/ static void - at TYP@_divide(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _square(char **args, intp *dimensions, intp *steps, void *data) { - register intp i, is1=steps[0],is2=steps[1],os=steps[2],n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i 0) != (y > 0)) && (x % y != 0)) tmp--; - *((@typ@ *)op)= tmp; - } + UNARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + *((@s@@type@ *)op) = 1.0/in1; } } -/**end repeat**/ - -/**begin repeat - #TYP=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG# - #typ=char, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong# - #otyp=float*4, double*6# -*/ static void - at TYP@_true_divide(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _conjugate(char **args, intp *dimensions, intp *steps, void *func) { - register intp i, is1=steps[0],is2=steps[1],os=steps[2],n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i># + */ static void - at TYP@_square(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - intp i, is1 = steps[0], os = steps[1], n = dimensions[0]; - char *i1 = args[0], *op = args[1]; - c at typ@ *x, *y; - @typ@ xr, xi; - - for (i = 0; i < n; i++, i1 += is1, op += os) { - x = (c at typ@ *)i1; - y = (c at typ@ *)op; - xr = x->real; - xi = x->imag; - y->real = xr*xr - xi*xi; - y->imag = 2*xr*xi; + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + *((@s@@type@ *)op) = in1 @OP@ in2; } } -/**end repeat**/ +/**end repeat2**/ -static PyObject * -Py_square(PyObject *o) +/**begin repeat2 + * #kind = equal, not_equal, greater, greater_equal, less, less_equal, + * logical_and, logical_or# + * #OP = ==, !=, >, >=, <, <=, &&, ||# + */ +static void + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - return PyNumber_Multiply(o, o); + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + *((Bool *)op) = in1 @OP@ in2; + } } +/**end repeat2**/ - -/**begin repeat - #TYP=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE# - #typ=char, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble# -*/ static void - at TYP@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _logical_xor(char **args, intp *dimensions, intp *steps, void *func) { - intp i, is1 = steps[0], os = steps[1], n = dimensions[0]; - char *i1 = args[0], *op = args[1]; - - for (i = 0; i < n; i++, i1 += is1, op += os) { - @typ@ x = *((@typ@ *)i1); - *((@typ@ *)op) = (@typ@) (1.0 / x); + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + *((Bool *)op)= (in1 && !in2) || (!in1 && in2); } } -/**end repeat**/ -/**begin repeat - #TYP=CFLOAT,CDOUBLE,CLONGDOUBLE# - #typ=float, double, longdouble# -*/ +/**begin repeat2 + * #kind = maximum, minimum# + * #OP = >, <# + **/ static void - at TYP@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - intp i, is1 = steps[0], os = steps[1], n = dimensions[0]; - char *i1 = args[0], *op = args[1]; - c at typ@ *x, *y; - @typ@ xr, xi, r, denom; - - for (i = 0; i < n; i++, i1 += is1, op += os) { - x = (c at typ@ *)i1; - y = (c at typ@ *)op; - xr = x->real; - xi = x->imag; - if (fabs(xi) <= fabs(xr)) { - r = xi / xr; - denom = xr + xi * r; - y->real = 1 / denom; - y->imag = -r / denom; - } else { - r = xr / xi; - denom = xr * r + xi; - y->real = r / denom; - y->imag = -1 / denom; - } + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + *((@s@@type@ *)op) = (in1 @OP@ in2) ? in1 : in2; } } -/**end repeat**/ +/**end repeat2**/ - -static PyObject * -Py_reciprocal(PyObject *o) +static void + at S@@TYPE at _true_divide(char **args, intp *dimensions, intp *steps, void *func) { - PyObject *one, *result; - one = PyInt_FromLong(1); - if (!one) return NULL; - result = PyNumber_Divide(one, o); - Py_DECREF(one); - return result; + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + if (in2 == 0) { + generate_divbyzero_error(); + *((@ftype@ *)op) = 0; + } + else { + *((@ftype@ *)op) = (@ftype@)in1 / (@ftype@)in2; + } + } } -static PyObject * -_npy_ObjectMax(PyObject *i1, PyObject *i2) +static void + at S@@TYPE at _power(char **args, intp *dimensions, intp *steps, void *func) { - int cmp; - PyObject *res; - if (PyObject_Cmp(i1, i2, &cmp) < 0) return NULL; - - if (cmp >= 0) { - res = i1; + BINARY_LOOP { + const @ftype@ in1 = (@ftype@)*(@s@@type@ *)ip1; + const @ftype@ in2 = (@ftype@)*(@s@@type@ *)ip2; + *((@s@@type@ *)op) = (@s@@type@) pow(in1, in2); } - else { - res = i2; - } - Py_INCREF(res); - return res; } -static PyObject * -_npy_ObjectMin(PyObject *i1, PyObject *i2) +static void + at S@@TYPE at _fmod(char **args, intp *dimensions, intp *steps, void *func) { - int cmp; - PyObject *res; - if (PyObject_Cmp(i1, i2, &cmp) < 0) return NULL; + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + if (in2 == 0) { + generate_divbyzero_error(); + *((@s@@type@ *)op) = 0; + } + else { + *((@s@@type@ *)op)= in1 % in2; + } - if (cmp <= 0) { - res = i1; } - else { - res = i2; - } - Py_INCREF(res); - return res; } -/* ones_like is defined here because it's used for x**0 */ +/**end repeat1**/ -/**begin repeat - #TYP=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE# - #typ=char, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble# -*/ static void - at TYP@_ones_like(char **args, intp *dimensions, intp *steps, void *data) +U at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) { - intp i, os = steps[1], n = dimensions[0]; - char *op = args[1]; - - for (i = 0; i < n; i++, op += os) { - *((@typ@ *)op) = 1; + UNARY_LOOP { + const u at type@ in1 = *(u at type@ *)ip1; + *((u at type@ *)op) = in1; } } -/**end repeat**/ -/**begin repeat - #TYP=CFLOAT,CDOUBLE,CLONGDOUBLE# - #typ=float, double, longdouble# -*/ static void - at TYP@_ones_like(char **args, intp *dimensions, intp *steps, void *data) + at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) { - intp i, is1 = steps[0], os = steps[1], n = dimensions[0]; - char *i1 = args[0], *op = args[1]; - c at typ@ *y; - - for (i = 0; i < n; i++, i1 += is1, op += os) { - y = (c at typ@ *)op; - y->real = 1.0; - y->imag = 0.0; + UNARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + *((@type@ *)op) = (in1 >= 0) ? in1 : -in1; } } -/**end repeat**/ -static PyObject * -Py_get_one(PyObject *o) +static void +U at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) { - return PyInt_FromLong(1); + UNARY_LOOP { + const u at type@ in1 = *(u at type@ *)ip1; + *((u at type@ *)op) = in1 > 0 ? 1 : 0; + } } - -/**begin repeat - #TYP=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG# - #typ=char, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong# - #btyp=float*4, double*6# -*/ static void - at TYP@_power(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) { - register intp i, is1=steps[0],is2=steps[1]; - register intp os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - @btyp@ x, y; + UNARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + *((@type@ *)op) = in1 > 0 ? 1 : (in1 < 0 ? -1 : 0); + } +} - for(i=0; i 0) != (in2 > 0)) && (in1 % in2 != 0)) { + *((@type@ *)op) = in1/in2 - 1; + } + else { + *((@type@ *)op) = in1/in2; + } } } -/**end repeat**/ -/**begin repeat - #TYP=UBYTE, BYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE# - #typ=ubyte, char, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble# -*/ static void - at TYP@_conjugate(char **args, intp *dimensions, intp *steps, void *func) +U at TYPE@_divide(char **args, intp *dimensions, intp *steps, void *func) { - register intp i, is1=steps[0], os=steps[1], n=dimensions[0]; - char *i1=args[0], *op=args[1]; - for(i=0; i 0) == (in2 > 0) || rem == 0) { + *((@type@ *)op) = rem; + } + else { + *((@type@ *)op) = rem + in2; + } + } + } +} - for(i=0; i, >=, &&, ||# + */ static void - at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i, n; - intp is1=steps[0], os=steps[1]; - char *i1=args[0], *op=args[1]; - - n=dimensions[0]; - for(i=0; i, >=, <, <=, ==, !=, &&, ||, &, |, ^# -**/ static void -BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_logical_not(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - Bool in1, in2; - for(i=0; i*13, >=*13, <*13, <=*13# - #typ=(byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*4# - #kind= greater*13, greater_equal*13, less*13, less_equal*13# -*/ - +/**begin repeat1 + * #kind = isnan, isinf, isfinite, signbit# + * #func = isnan, isinf, isfinite, signbit# + **/ static void @TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i*3, >=*3, <*3, <=*3# - #typ=(cfloat, cdouble, clongdouble)*4# - #kind= greater*3, greater_equal*3, less*3, less_equal*3# -*/ - +/**begin repeat1 + * #kind = maximum, minimum# + * #OP = >, <# + **/ static void @TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; ireal == ((@typ@ *)i2)->real) - *((Bool *)op)=((@typ@ *)i1)->imag @OP@ \ - ((@typ@ *)i2)->imag; - else - *((Bool *)op)=((@typ@ *)i1)->real @OP@ \ - ((@typ@ *)i2)->real; + /* */ + BINARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + const @type@ in2 = *(@type@ *)ip2; + *((@type@ *)op) = in1 @OP@ in2 ? in1 : in2; } } -/**end repeat**/ +/**end repeat1**/ +static void + at TYPE@_floor_divide(char **args, intp *dimensions, intp *steps, void *func) +{ + BINARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + const @type@ in2 = *(@type@ *)ip2; + *((@type@ *)op) = floor at c@(in1/in2); + } +} -/**begin repeat - #TYPE=(BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE)*4# - #typ=(byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*4# - #OP= ==*13, !=*13, &&*13, ||*13# - #kind=equal*13, not_equal*13, logical_and*13, logical_or*13# -*/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i 0) ? in1 : -in1; + /* add 0 to clear -0.0 */ + *((@type@ *)op) = tmp + 0; } } -/**end repeat**/ -#define BOOL_negative BOOL_logical_not - -#define _SIGN1(x) ((x) > 0 ? 1 : ((x) < 0 ? -1 : 0)) -#define _SIGN2(x) ((x) == 0 ? 0 : 1) -#define _SIGNC(x) (((x).real > 0) ? 1 : ((x).real < 0 ? -1 : ((x).imag > 0 ? 1 : ((x).imag < 0) ? -1 : 0))) -/**begin repeat - #TYPE=BYTE,SHORT,INT,LONG,LONGLONG,FLOAT,DOUBLE,LONGDOUBLE,UBYTE,USHORT,UINT,ULONG,ULONGLONG# - #typ=byte,short,int,long,longlong,float,double,longdouble,ubyte,ushort,uint,ulong,ulonglong# - #func=_SIGN1*8,_SIGN2*5# -*/ static void - at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_negative(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],os=steps[1], n=dimensions[0]; - char *i1=args[0], *op=args[1]; - @typ@ t1; - for(i=0; i 0) { + *((@type@ *)op) = 1; + } + else if (in1 < 0) { + *((@type@ *)op) = -1; + } + else { + *((@type@ *)op) = 0; + } } } -/**end repeat**/ -#undef _SIGN1 -#undef _SIGN2 -#undef _SIGNC - - static void -OBJECT_sign(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_modf(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],os=steps[1], n=dimensions[0]; - char *i1=args[0], *op=args[1]; - PyObject *t1, *zero, *res; - zero = PyInt_FromLong(0); - for(i=0; ireal || \ - ((@typ@ *)i1)->imag); + BINARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + const int in2 = *(int *)ip2; + *(@type@ *)op = ldexp at c@(in1, in2); } } -/**end repeat**/ +#endif +#undef HAVE_DOUBLE_FUNCS +#define @TYPE at _true_divide @TYPE at _divide +/**end repeat**/ +/* + ***************************************************************************** + ** COMPLEX LOOPS ** + ***************************************************************************** + */ + /**begin repeat - #TYPE=BYTE,SHORT,INT,LONG,LONGLONG# - #typ=byte, short, int, long, longlong# - #c=f*2,,,l*1# -*/ + * complex types + * #ctype= cfloat, cdouble, clongdouble# + * #CTYPE= CFLOAT, CDOUBLE, CLONGDOUBLE# + * #type = float, double, longdouble# + * #c = f, , l# + */ + +/**begin repeat1 + * arithmetic + * #kind = add, subtract# + * #OP = +, -# + */ static void - at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - register @typ@ ix,iy, tmp; - for(i=0; i 0) == (iy > 0)) { - *((@typ@ *)op) = ix % iy; - } - else { /* handle mixed case the way Python does */ - tmp = ix % iy; - if (tmp) tmp += iy; - *((@typ@ *)op)= tmp; - } + BINARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + const @type@ in2r = ((@type@ *)ip2)[0]; + const @type@ in2i = ((@type@ *)ip2)[1]; + ((@type@ *)op)[0] = in1r @OP@ in2r; + ((@type@ *)op)[1] = in1i @OP@ in2i; } } -/**end repeat**/ +/**end repeat1**/ -/**begin repeat - #TYPE=UBYTE,USHORT,UINT,ULONG,ULONGLONG# - #typ=ubyte, ushort, uint, ulong, ulonglong# -*/ static void - at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_multiply(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - register @typ@ ix,iy; - for(i=0; i, >=, <, <=# + */ +static void + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +{ + BINARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + const @type@ in2r = ((@type@ *)ip2)[0]; + const @type@ in2i = ((@type@ *)ip2)[1]; + if (in1r != in2r) { + *((Bool *)op) = in1r @OP@ in2r ? 1 : 0; } else { - *((@typ@ *)op)= x % y; + *((Bool *)op) = in1i @OP@ in2i ? 1 : 0; } - } } -/**end repeat**/ +/**end repeat1**/ -/**begin repeat - - #TYPE=(BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG)*5# - #typ=(byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong)*5# - #OP= &*10, |*10, ^*10, <<*10, >>*10# - #kind=bitwise_and*10, bitwise_or*10, bitwise_xor*10, left_shift*10, right_shift*10# - +/**begin repeat1 + #kind = logical_and, logical_or# + #OP1 = ||, ||# + #OP2 = &&, ||# */ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - register char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; ireal || ((@typ@ *)i1)->imag; - p2 = ((@typ@ *)i2)->real || ((@typ@ *)i2)->imag; - *((Bool *)op)= (p1 || p2) && !(p1 && p2); + UNARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + ((@type@ *)op)[0] = in1r*in1r - in1i*in1i; + ((@type@ *)op)[1] = in1r*in1i + in1i*in1r; } } -/**end repeat**/ - - -/**begin repeat - - #TYPE=(BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE)*2# - #OP= >*14, <*14# - #typ=(Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*2# - #kind= maximum*14, minimum*14# -*/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i*3, <*3# - #typ=(cfloat, cdouble, clongdouble)*2# - #kind= maximum*3, minimum*3# -*/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ones_like(char **args, intp *dimensions, intp *steps, void *data) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - @typ@ *i1c, *i2c; - for(i=0; ireal @OP@ i2c->real) || \ - ((i1c->real==i2c->real) && (i1c->imag @OP@ i2c->imag))) - memmove(op, i1, sizeof(@typ@)); - else - memmove(op, i2, sizeof(@typ@)); + OUTPUT_LOOP { + ((@type@ *)op)[0] = 1; + ((@type@ *)op)[1] = 0; } } -/**end repeat**/ +static void + at CTYPE@_conjugate(char **args, intp *dimensions, intp *steps, void *func) { + UNARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + ((@type@ *)op)[0] = in1r; + ((@type@ *)op)[1] = -in1i; + } +} - -/*** isinf, isinf, isfinite, signbit ***/ -/**begin repeat - #kind=isnan*3, isinf*3, isfinite*3, signbit*3# - #TYPE=(FLOAT, DOUBLE, LONGDOUBLE)*4# - #typ=(float, double, longdouble)*4# - #c=(f,,l)*4# -*/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is=steps[0], os=steps[1], n=dimensions[0]; - char *ip=args[0], *op=args[1]; - for(i=0; i 0) { + ((@type@ *)op)[0] = 1; + } + else if (in1r < 0) { + ((@type@ *)op)[0] = -1; + } + else { + if (in1i > 0) { + ((@type@ *)op)[0] = 1; + } + else if (in1i < 0) { + ((@type@ *)op)[0] = -1; + } + else { + ((@type@ *)op)[0] = 0; + } + } + ((@type@ *)op)[1] = 0; } } -/**end repeat**/ - - - -/****** modf ****/ - -/**begin repeat - #TYPE=FLOAT, DOUBLE, LONGDOUBLE# - #typ=float, double, longdouble# - #c=f,,l# -*/ +/**begin repeat1 + * #kind = maximum, minimum# + * #OP = >, <# + */ static void - at TYPE@_modf(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],os1=steps[1],os2=steps[2],n=dimensions[0]; - char *i1=args[0], *op1=args[1], *op2=args[2]; - @typ@ x1, y1, y2; - for (i=0; i Author: oliphant Date: 2008-10-02 15:27:17 -0500 (Thu, 02 Oct 2008) New Revision: 5889 Modified: trunk/numpy/core/src/ufuncobject.c trunk/numpy/core/tests/test_umath.py Log: Fix problem with subclasses of object arrays. Modified: trunk/numpy/core/src/ufuncobject.c =================================================================== --- trunk/numpy/core/src/ufuncobject.c 2008-10-01 18:08:41 UTC (rev 5888) +++ trunk/numpy/core/src/ufuncobject.c 2008-10-02 20:27:17 UTC (rev 5889) @@ -1427,12 +1427,15 @@ * FAIL with NotImplemented if the other object has * the __r__ method and has __array_priority__ as * an attribute (signalling it can handle ndarray's) - * and is not already an ndarray + * and is not already an ndarray or a subtype of the same type. */ if ((arg_types[1] == PyArray_OBJECT) && \ (loop->ufunc->nin==2) && (loop->ufunc->nout == 1)) { PyObject *_obj = PyTuple_GET_ITEM(args, 1); - if (!PyArray_CheckExact(_obj) && \ + if (!PyArray_CheckExact(_obj) && + /* If both are same subtype of object arrays, then proceed */ + !(_obj->ob_type == (PyTuple_GET_ITEM(args, 0))->ob_type) && \ + PyObject_HasAttrString(_obj, "__array_priority__") && \ _has_reflected_op(_obj, loop->ufunc->name)) { loop->notimplemented = 1; Modified: trunk/numpy/core/tests/test_umath.py =================================================================== --- trunk/numpy/core/tests/test_umath.py 2008-10-01 18:08:41 UTC (rev 5888) +++ trunk/numpy/core/tests/test_umath.py 2008-10-02 20:27:17 UTC (rev 5889) @@ -281,6 +281,16 @@ assert_equal(add.nout, 1) assert_equal(add.identity, 0) +class TestSubclass(TestCase): + def test_subclass_op(self): + class simple(np.ndarray): + def __new__(subtype, shape): + self = np.ndarray.__new__(subtype, shape, dtype=object) + self.fill(0) + return self + a = simple((3,4)) + assert_equal(a+a, a) + def _check_branch_cut(f, x0, dx, re_sign=1, im_sign=-1, sig_zero_ok=False, dtype=np.complex): """ From numpy-svn at scipy.org Thu Oct 2 16:33:58 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 2 Oct 2008 15:33:58 -0500 (CDT) Subject: [Numpy-svn] r5890 - in branches/1.1.x/numpy/core: src tests Message-ID: <20081002203358.66BC839C2ED@scipy.org> Author: oliphant Date: 2008-10-02 15:33:57 -0500 (Thu, 02 Oct 2008) New Revision: 5890 Modified: branches/1.1.x/numpy/core/src/ufuncobject.c branches/1.1.x/numpy/core/tests/test_umath.py Log: Fix error in subclasses of NumPy arrays with object data types. Modified: branches/1.1.x/numpy/core/src/ufuncobject.c =================================================================== --- branches/1.1.x/numpy/core/src/ufuncobject.c 2008-10-02 20:27:17 UTC (rev 5889) +++ branches/1.1.x/numpy/core/src/ufuncobject.c 2008-10-02 20:33:57 UTC (rev 5890) @@ -1391,15 +1391,19 @@ &(loop->funcdata), scalars, typetup) == -1) return -1; - /* FAIL with NotImplemented if the other object has - the __r__ method and has __array_priority__ as - an attribute (signalling it can handle ndarray's) - and is not already an ndarray - */ + /* + * FAIL with NotImplemented if the other object has + * the __r__ method and has __array_priority__ as + * an attribute (signalling it can handle ndarray's) + * and is not already an ndarray or a subtype of the same type. + */ if ((arg_types[1] == PyArray_OBJECT) && \ (loop->ufunc->nin==2) && (loop->ufunc->nout == 1)) { PyObject *_obj = PyTuple_GET_ITEM(args, 1); - if (!PyArray_CheckExact(_obj) && \ + if (!PyArray_CheckExact(_obj) && + /* If both are same subtype of object arrays, then proceed */ + !(_obj->ob_type == (PyTuple_GET_ITEM(args, 0))->ob_type) && \ + PyObject_HasAttrString(_obj, "__array_priority__") && \ _has_reflected_op(_obj, loop->ufunc->name)) { loop->notimplemented = 1; Modified: branches/1.1.x/numpy/core/tests/test_umath.py =================================================================== --- branches/1.1.x/numpy/core/tests/test_umath.py 2008-10-02 20:27:17 UTC (rev 5889) +++ branches/1.1.x/numpy/core/tests/test_umath.py 2008-10-02 20:33:57 UTC (rev 5890) @@ -218,5 +218,15 @@ assert_equal(add.nout, 1) assert_equal(add.identity, 0) +class TestSubclass(TestCase): + def test_subclass_op(self): + class simple(np.ndarray): + def __new__(subtype, shape): + self = np.ndarray.__new__(subtype, shape, dtype=object) + self.fill(0) + return self + a = simple((3,4)) + assert_equal(a+a, a) + if __name__ == "__main__": NumpyTest().run() From numpy-svn at scipy.org Thu Oct 2 16:37:01 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 2 Oct 2008 15:37:01 -0500 (CDT) Subject: [Numpy-svn] r5891 - in branches/1.2.x/numpy/core: src tests Message-ID: <20081002203701.D91C739C2ED@scipy.org> Author: oliphant Date: 2008-10-02 15:37:00 -0500 (Thu, 02 Oct 2008) New Revision: 5891 Modified: branches/1.2.x/numpy/core/src/ufuncobject.c branches/1.2.x/numpy/core/tests/test_umath.py Log: BUG: Backport fix to object arrays in r5889 to 1.2.x branch. Modified: branches/1.2.x/numpy/core/src/ufuncobject.c =================================================================== --- branches/1.2.x/numpy/core/src/ufuncobject.c 2008-10-02 20:33:57 UTC (rev 5890) +++ branches/1.2.x/numpy/core/src/ufuncobject.c 2008-10-02 20:37:00 UTC (rev 5891) @@ -1427,12 +1427,15 @@ * FAIL with NotImplemented if the other object has * the __r__ method and has __array_priority__ as * an attribute (signalling it can handle ndarray's) - * and is not already an ndarray + * and is not already an ndarray or a subtype of the same type. */ if ((arg_types[1] == PyArray_OBJECT) && \ (loop->ufunc->nin==2) && (loop->ufunc->nout == 1)) { PyObject *_obj = PyTuple_GET_ITEM(args, 1); - if (!PyArray_CheckExact(_obj) && \ + if (!PyArray_CheckExact(_obj) && + /* If both are same subtype of object arrays, then proceed */ + !(_obj->ob_type == (PyTuple_GET_ITEM(args, 0))->ob_type) && \ + PyObject_HasAttrString(_obj, "__array_priority__") && \ _has_reflected_op(_obj, loop->ufunc->name)) { loop->notimplemented = 1; Modified: branches/1.2.x/numpy/core/tests/test_umath.py =================================================================== --- branches/1.2.x/numpy/core/tests/test_umath.py 2008-10-02 20:33:57 UTC (rev 5890) +++ branches/1.2.x/numpy/core/tests/test_umath.py 2008-10-02 20:37:00 UTC (rev 5891) @@ -278,6 +278,16 @@ assert_equal(add.nout, 1) assert_equal(add.identity, 0) +class TestSubclass(TestCase): + def test_subclass_op(self): + class simple(np.ndarray): + def __new__(subtype, shape): + self = np.ndarray.__new__(subtype, shape, dtype=object) + self.fill(0) + return self + a = simple((3,4)) + assert_equal(a+a, a) + def _check_branch_cut(f, x0, dx, re_sign=1, im_sign=-1, sig_zero_ok=False, dtype=np.complex): """ From numpy-svn at scipy.org Thu Oct 2 22:04:12 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 2 Oct 2008 21:04:12 -0500 (CDT) Subject: [Numpy-svn] r5892 - branches/ufunc_cleanup/numpy/core/include/numpy Message-ID: <20081003020412.E28DD39C107@scipy.org> Author: charris Date: 2008-10-02 21:04:10 -0500 (Thu, 02 Oct 2008) New Revision: 5892 Modified: branches/ufunc_cleanup/numpy/core/include/numpy/ufuncobject.h Log: Add PyUFunc_Nan. Modified: branches/ufunc_cleanup/numpy/core/include/numpy/ufuncobject.h =================================================================== --- branches/ufunc_cleanup/numpy/core/include/numpy/ufuncobject.h 2008-10-02 20:37:00 UTC (rev 5891) +++ branches/ufunc_cleanup/numpy/core/include/numpy/ufuncobject.h 2008-10-03 02:04:10 UTC (rev 5892) @@ -184,6 +184,7 @@ #define PyUFunc_One 1 #define PyUFunc_Zero 0 #define PyUFunc_None -1 +#define PyUFunc_Nan NAN #define UFUNC_REDUCE 0 #define UFUNC_ACCUMULATE 1 From numpy-svn at scipy.org Thu Oct 2 22:11:52 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 2 Oct 2008 21:11:52 -0500 (CDT) Subject: [Numpy-svn] r5893 - branches/ufunc_cleanup/numpy/testing Message-ID: <20081003021152.80F8339C107@scipy.org> Author: charris Date: 2008-10-02 21:11:50 -0500 (Thu, 02 Oct 2008) New Revision: 5893 Modified: branches/ufunc_cleanup/numpy/testing/utils.py Log: Add assert_ to testing module. Use as assert_(condition, message). This function does not disappear when python runs with the -OO option. Modified: branches/ufunc_cleanup/numpy/testing/utils.py =================================================================== --- branches/ufunc_cleanup/numpy/testing/utils.py 2008-10-03 02:04:10 UTC (rev 5892) +++ branches/ufunc_cleanup/numpy/testing/utils.py 2008-10-03 02:11:50 UTC (rev 5893) @@ -8,14 +8,19 @@ import operator from nosetester import import_nose -__all__ = ['assert_equal', 'assert_almost_equal','assert_approx_equal', - 'assert_array_equal', 'assert_array_less', 'assert_string_equal', - 'assert_array_almost_equal', 'assert_raises', 'build_err_msg', - 'decorate_methods', 'jiffies', 'memusage', 'print_assert_equal', - 'raises', 'rand', 'rundocs', 'runstring', 'verbose'] +__all__ = ['assert_', 'assert_equal', 'assert_almost_equal', + 'assert_approx_equal', 'assert_array_equal', 'assert_array_less', + 'assert_string_equal', 'assert_array_almost_equal', 'assert_raises', + 'build_err_msg', 'decorate_methods', 'jiffies', 'memusage', + 'print_assert_equal', 'raises', 'rand', 'rundocs', 'runstring', + 'verbose'] verbose = 0 +def assert_(test, message=""): + if not test: + raise AssertionError(message) + def rand(*args): """Returns an array of random numbers with the given shape. From numpy-svn at scipy.org Thu Oct 2 22:19:23 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 2 Oct 2008 21:19:23 -0500 (CDT) Subject: [Numpy-svn] r5894 - in branches/ufunc_cleanup/numpy/core: code_generators src Message-ID: <20081003021923.29C1A39C107@scipy.org> Author: charris Date: 2008-10-02 21:19:17 -0500 (Thu, 02 Oct 2008) New Revision: 5894 Modified: branches/ufunc_cleanup/numpy/core/code_generators/generate_umath.py branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src Log: Add fmax, fmin functions for floats and complex. These conform to the ieee standard for these functions. For numpy they are extended to complex numbers, where a complex is considered a nan if either the real or complex part is. In this case nan + nan*1j is returned if both arguments are nans. Modify maximum and minimum so that if either input is nan, then nan is returned. Likewise for the complex version. Modified: branches/ufunc_cleanup/numpy/core/code_generators/generate_umath.py =================================================================== --- branches/ufunc_cleanup/numpy/core/code_generators/generate_umath.py 2008-10-03 02:11:50 UTC (rev 5893) +++ branches/ufunc_cleanup/numpy/core/code_generators/generate_umath.py 2008-10-03 02:19:17 UTC (rev 5894) @@ -6,6 +6,7 @@ Zero = "PyUFunc_Zero" One = "PyUFunc_One" +Nan = "PyUFunc_Nan" None_ = "PyUFunc_None" class TypeDescription(object): @@ -316,6 +317,16 @@ TD(noobj), TD(O, f='_npy_ObjectMin') ), +'fmax' : + Ufunc(2, 1, Nan, + "", + TD(inexact), + ), +'fmin' : + Ufunc(2, 1, Nan, + "", + TD(inexact), + ), 'bitwise_and' : Ufunc(2, 1, One, docstrings.get('numpy.core.umath.bitwise_and'), Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-03 02:11:50 UTC (rev 5893) +++ branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-03 02:19:17 UTC (rev 5894) @@ -1579,7 +1579,7 @@ /**begin repeat1 * #kind = maximum, minimum# - * #OP = >, <# + * #OP = >=, <=# **/ static void @TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) @@ -1588,12 +1588,28 @@ BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; const @type@ in2 = *(@type@ *)ip2; - *((@type@ *)op) = in1 @OP@ in2 ? in1 : in2; + *((@type@ *)op) = (in1 @OP@ in2 || isnan(in1)) ? in1 : in2; } } /**end repeat1**/ +/**begin repeat1 + * #kind = fmax, fmin# + * #OP = >=, <=# + **/ static void + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +{ + /* */ + BINARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + const @type@ in2 = *(@type@ *)ip2; + *((@type@ *)op) = (in1 @OP@ in2 || isnan(in2)) ? in1 : in2; + } +} +/**end repeat1**/ + +static void @TYPE at _floor_divide(char **args, intp *dimensions, intp *steps, void *func) { BINARY_LOOP { @@ -1680,15 +1696,7 @@ /* */ UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; - if (in1 > 0) { - *((@type@ *)op) = 1; - } - else if (in1 < 0) { - *((@type@ *)op) = -1; - } - else { - *((@type@ *)op) = 0; - } + *((@type@ *)op) = in1 > 0 ? 1 : (in1 < 0 ? -1 : 0); } } @@ -1988,9 +1996,12 @@ } } +#define GE(xr,xi,yr,yi) (xr > yr || (xr == yr && xi >= yi)) +#define LE(xr,xi,yr,yi) (xr < yr || (xr == yr && xi <= yi)) /**begin repeat1 * #kind = maximum, minimum# - * #OP = >, <# + * #OP1 = GE, LE# + * #OP2 = LE, GE# */ static void @CTYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) @@ -2000,17 +2011,53 @@ const @type@ in1i = ((@type@ *)ip1)[1]; const @type@ in2r = ((@type@ *)ip2)[0]; const @type@ in2i = ((@type@ *)ip2)[1]; - if (in1r @OP@ in2r || ((in1r == in2r) && (in1i @OP@ in2i))) { + if (@OP1@(in1r, in1i, in2r, in2i)) { ((@type@ *)op)[0] = in1r; ((@type@ *)op)[1] = in1i; } + else if (@OP2@(in1r, in1i, in2r, in2i)) { + ((@type@ *)op)[0] = in2r; + ((@type@ *)op)[1] = in2i; + } else { + ((@type@ *)op)[0] = NAN; + ((@type@ *)op)[1] = 0; + } + } +} +/**end repeat1**/ + +/**begin repeat1 + * #kind = fmax, fmin# + * #OP1 = GE, LE# + */ +static void + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +{ + BINARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + const @type@ in2r = ((@type@ *)ip2)[0]; + const @type@ in2i = ((@type@ *)ip2)[1]; + if (@OP1@(in1r, in1i, in2r, in2i) || isnan(in2r) || isnan(in2i)) { + if (isnan(in1r) || isnan(in1i)) { + ((@type@ *)op)[0] = NAN; + ((@type@ *)op)[1] = 0; + } + else { + ((@type@ *)op)[0] = in1r; + ((@type@ *)op)[1] = in1i; + } + } + else { ((@type@ *)op)[0] = in2r; ((@type@ *)op)[1] = in2i; } } } /**end repeat1**/ +#undef GE +#undef LE #define @CTYPE at _true_divide @CTYPE at _divide /**end repeat**/ @@ -2251,7 +2298,7 @@ pinf = pinf_init(); pzero = pzero_init(); - mynan = pinf / pinf; + mynan = copysign(pinf / pinf, 1); PyModule_AddObject(m, "PINF", PyFloat_FromDouble(pinf)); PyModule_AddObject(m, "NINF", PyFloat_FromDouble(-pinf)); From numpy-svn at scipy.org Thu Oct 2 22:22:32 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 2 Oct 2008 21:22:32 -0500 (CDT) Subject: [Numpy-svn] r5895 - branches/ufunc_cleanup/numpy/core/src Message-ID: <20081003022232.C720A39C107@scipy.org> Author: charris Date: 2008-10-02 21:22:31 -0500 (Thu, 02 Oct 2008) New Revision: 5895 Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src Log: Make the complex nans returned from fmax/fmin/maximum/minimum have both real and imaginary parts set to nan. Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-03 02:19:17 UTC (rev 5894) +++ branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-03 02:22:31 UTC (rev 5895) @@ -2021,7 +2021,7 @@ } else { ((@type@ *)op)[0] = NAN; - ((@type@ *)op)[1] = 0; + ((@type@ *)op)[1] = NAN; } } } @@ -2042,7 +2042,7 @@ if (@OP1@(in1r, in1i, in2r, in2i) || isnan(in2r) || isnan(in2i)) { if (isnan(in1r) || isnan(in1i)) { ((@type@ *)op)[0] = NAN; - ((@type@ *)op)[1] = 0; + ((@type@ *)op)[1] = NAN; } else { ((@type@ *)op)[0] = in1r; From numpy-svn at scipy.org Fri Oct 3 02:50:36 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 3 Oct 2008 01:50:36 -0500 (CDT) Subject: [Numpy-svn] r5896 - trunk/numpy/distutils/command Message-ID: <20081003065036.D017D39C088@scipy.org> Author: cdavid Date: 2008-10-03 01:50:32 -0500 (Fri, 03 Oct 2008) New Revision: 5896 Modified: trunk/numpy/distutils/command/scons.py Log: Update the minimum version for numscons: had to change to cope with Chuck changes to conv_template.py. Modified: trunk/numpy/distutils/command/scons.py =================================================================== --- trunk/numpy/distutils/command/scons.py 2008-10-03 02:22:31 UTC (rev 5895) +++ trunk/numpy/distutils/command/scons.py 2008-10-03 06:50:32 UTC (rev 5896) @@ -360,7 +360,7 @@ "this package " % str(e)) try: - minver = "0.9.1" + minver = "0.9.3" from numscons import get_version if get_version() < minver: raise ValueError() From numpy-svn at scipy.org Fri Oct 3 02:51:06 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 3 Oct 2008 01:51:06 -0500 (CDT) Subject: [Numpy-svn] r5897 - trunk/tools/win32build Message-ID: <20081003065106.001E139C088@scipy.org> Author: cdavid Date: 2008-10-03 01:51:03 -0500 (Fri, 03 Oct 2008) New Revision: 5897 Modified: trunk/tools/win32build/doall.py Log: Update doall script: take the python version to build binaries from the command line instead of global variable. Modified: trunk/tools/win32build/doall.py =================================================================== --- trunk/tools/win32build/doall.py 2008-10-03 06:50:32 UTC (rev 5896) +++ trunk/tools/win32build/doall.py 2008-10-03 06:51:03 UTC (rev 5897) @@ -1,13 +1,25 @@ import subprocess import os -PYVER = "2.5" +if __name__ == '__main__': + from optparse import OptionParser + parser = OptionParser() + parser.add_option("-p", "--pyver", dest="pyver", + help = "Python version (2.4, 2.5, etc...)") -# Bootstrap -subprocess.check_call(['python', 'prepare_bootstrap.py', '-p', PYVER]) + opts, args = parser.parse_args() + pyver = opts.pyver -# Build binaries -subprocess.check_call(['python', 'build.py', '-p', PYVER], cwd = 'bootstrap-%s' % PYVER) + if not pyver: + pyver = "2.5" -# Build installer using nsis -subprocess.check_call(['makensis', 'numpy-superinstaller.nsi'], cwd = 'bootstrap-%s' % PYVER) + # Bootstrap + subprocess.check_call(['python', 'prepare_bootstrap.py', '-p', pyver]) + + # Build binaries + subprocess.check_call(['python', 'build.py', '-p', pyver], + cwd = 'bootstrap-%s' % pyver) + + # Build installer using nsis + subprocess.check_call(['makensis', 'numpy-superinstaller.nsi'], + cwd = 'bootstrap-%s' % pyver) From numpy-svn at scipy.org Fri Oct 3 03:21:06 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 3 Oct 2008 02:21:06 -0500 (CDT) Subject: [Numpy-svn] r5898 - branches/clean_math_config/numpy/core Message-ID: <20081003072106.DCDCA39C088@scipy.org> Author: cdavid Date: 2008-10-03 02:21:00 -0500 (Fri, 03 Oct 2008) New Revision: 5898 Modified: branches/clean_math_config/numpy/core/SConscript Log: Start updating numscons configuration for new math config. Modified: branches/clean_math_config/numpy/core/SConscript =================================================================== --- branches/clean_math_config/numpy/core/SConscript 2008-10-03 06:51:03 UTC (rev 5897) +++ branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:21:00 UTC (rev 5898) @@ -1,4 +1,4 @@ -# Last Change: Tue Aug 05 12:00 PM 2008 J +# Last Change: Fri Oct 03 03:00 PM 2008 J # vim:syntax=python import os import sys @@ -136,7 +136,15 @@ # Set value to 1 for each defined function (in math lib) mfuncs_defined = dict([(f, 0) for f in mfuncs]) -# TODO: checklib vs checkfunc ? +# Check for mandatory funcs: we barf if a single one of those is not there +mandatory_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", +"floor", "ceil", "sqrt", "log10", "log", "exp", "asin", "acos", "atan", "fmod", +'modf', 'frexp', 'ldexp'] + +if not config.CheckFuncsAtOnce(mandatory_funcs): + raise SystemError("One of the required function to build numpy is not" + " available (the list is %s)." % str(mandatory_funcs)) + def check_func(f): """Check that f is available in mlib, and add the symbol appropriately. """ st = config.CheckDeclaration(f, language = 'C', includes = "#include ") From numpy-svn at scipy.org Fri Oct 3 03:21:22 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 3 Oct 2008 02:21:22 -0500 (CDT) Subject: [Numpy-svn] r5899 - branches/clean_math_config/numpy/core Message-ID: <20081003072122.9329C39C088@scipy.org> Author: cdavid Date: 2008-10-03 02:21:15 -0500 (Fri, 03 Oct 2008) New Revision: 5899 Modified: branches/clean_math_config/numpy/core/SConscript Log: Add an help function to check a list of functions in scons build. Modified: branches/clean_math_config/numpy/core/SConscript =================================================================== --- branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:21:00 UTC (rev 5898) +++ branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:21:15 UTC (rev 5899) @@ -145,6 +145,15 @@ raise SystemError("One of the required function to build numpy is not" " available (the list is %s)." % str(mandatory_funcs)) +def check_funcs(funcs): + # Use check_funcs_once first, and if it does not work, test func per + # func. Return success only if all the functions are available + st = config.CheckFuncsAtOnce(func) + if not st: + # Global check failed, check func per func + for f in funcs: + st = config.CheckFunc(f, language = 'C') + def check_func(f): """Check that f is available in mlib, and add the symbol appropriately. """ st = config.CheckDeclaration(f, language = 'C', includes = "#include ") From numpy-svn at scipy.org Fri Oct 3 03:21:38 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 3 Oct 2008 02:21:38 -0500 (CDT) Subject: [Numpy-svn] r5900 - branches/clean_math_config/numpy/core Message-ID: <20081003072138.0F23639C088@scipy.org> Author: cdavid Date: 2008-10-03 02:21:31 -0500 (Fri, 03 Oct 2008) New Revision: 5900 Modified: branches/clean_math_config/numpy/core/SConscript Log: Fix typo in check_funcs. Modified: branches/clean_math_config/numpy/core/SConscript =================================================================== --- branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:21:15 UTC (rev 5899) +++ branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:21:31 UTC (rev 5900) @@ -148,7 +148,7 @@ def check_funcs(funcs): # Use check_funcs_once first, and if it does not work, test func per # func. Return success only if all the functions are available - st = config.CheckFuncsAtOnce(func) + st = config.CheckFuncsAtOnce(funcs) if not st: # Global check failed, check func per func for f in funcs: From numpy-svn at scipy.org Fri Oct 3 03:21:53 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 3 Oct 2008 02:21:53 -0500 (CDT) Subject: [Numpy-svn] r5901 - branches/clean_math_config/numpy/core Message-ID: <20081003072153.8B54639C088@scipy.org> Author: cdavid Date: 2008-10-03 02:21:46 -0500 (Fri, 03 Oct 2008) New Revision: 5901 Modified: branches/clean_math_config/numpy/core/SConscript Log: Check for some optional, C99 double math functions. Modified: branches/clean_math_config/numpy/core/SConscript =================================================================== --- branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:21:31 UTC (rev 5900) +++ branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:21:46 UTC (rev 5901) @@ -154,6 +154,13 @@ for f in funcs: st = config.CheckFunc(f, language = 'C') +# XXX: we do not test for hypot because python checks for it (HAVE_HYPOT in +# python.h... I wish they would clean their public headers someday) +optional_stdfuncs = ["expm1", "log1p", "acosh", "asinh", "atanh", + "rint", "trunc"] + +check_funcs(optional_stdfuncs) + def check_func(f): """Check that f is available in mlib, and add the symbol appropriately. """ st = config.CheckDeclaration(f, language = 'C', includes = "#include ") From numpy-svn at scipy.org Fri Oct 3 03:22:09 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 3 Oct 2008 02:22:09 -0500 (CDT) Subject: [Numpy-svn] r5902 - branches/clean_math_config/numpy/core Message-ID: <20081003072209.6BF0F39C088@scipy.org> Author: cdavid Date: 2008-10-03 02:22:02 -0500 (Fri, 03 Oct 2008) New Revision: 5902 Modified: branches/clean_math_config/numpy/core/SConscript Log: Check for float/long double C99 functions. Modified: branches/clean_math_config/numpy/core/SConscript =================================================================== --- branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:21:46 UTC (rev 5901) +++ branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:22:02 UTC (rev 5902) @@ -1,4 +1,4 @@ -# Last Change: Fri Oct 03 03:00 PM 2008 J +# Last Change: Fri Oct 03 04:00 PM 2008 J # vim:syntax=python import os import sys @@ -145,6 +145,9 @@ raise SystemError("One of the required function to build numpy is not" " available (the list is %s)." % str(mandatory_funcs)) +# Standard functions which may not be available and for which we have a +# replacement implementation +# def check_funcs(funcs): # Use check_funcs_once first, and if it does not work, test func per # func. Return success only if all the functions are available @@ -161,6 +164,16 @@ check_funcs(optional_stdfuncs) +# C99 functions: float and long double versions +c99_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", "floor", + "ceil", "rint", "trunc", "sqrt", "log10", "log", "exp", + "expm1", "asin", "acos", "atan", "asinh", "acosh", "atanh", + "hypot", "atan2", "pow", "fmod", "modf", 'frexp', 'ldexp'] + +for prec in ['l', 'f']: + fns = [f + prec for f in c99_funcs] + check_funcs(fns) + def check_func(f): """Check that f is available in mlib, and add the symbol appropriately. """ st = config.CheckDeclaration(f, language = 'C', includes = "#include ") From numpy-svn at scipy.org Fri Oct 3 03:22:25 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 3 Oct 2008 02:22:25 -0500 (CDT) Subject: [Numpy-svn] r5903 - branches/clean_math_config/numpy/core Message-ID: <20081003072225.8D77B39C088@scipy.org> Author: cdavid Date: 2008-10-03 02:22:18 -0500 (Fri, 03 Oct 2008) New Revision: 5903 Modified: branches/clean_math_config/numpy/core/SConscript Log: Add check for C99 macros related IEEE-754. Modified: branches/clean_math_config/numpy/core/SConscript =================================================================== --- branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:22:02 UTC (rev 5902) +++ branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:22:18 UTC (rev 5903) @@ -174,6 +174,18 @@ fns = [f + prec for f in c99_funcs] check_funcs(fns) +# Normally, isnan and isinf are macro (C99), but some platforms only have +# func, or both func and macro version. Check for macro only, and define +# replacement ones if not found. +# Note: including Python.h is necessary because it modifies some math.h +# definitions +for f in ["isnan", "isinf", "signbit", "isfinite"]: + includes = """\ +#include +#include +""" + config.CheckDeclaration(f, includes=includes) + def check_func(f): """Check that f is available in mlib, and add the symbol appropriately. """ st = config.CheckDeclaration(f, language = 'C', includes = "#include ") From numpy-svn at scipy.org Fri Oct 3 03:22:41 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 3 Oct 2008 02:22:41 -0500 (CDT) Subject: [Numpy-svn] r5904 - branches/clean_math_config/numpy/core Message-ID: <20081003072241.9962D39C088@scipy.org> Author: cdavid Date: 2008-10-03 02:22:34 -0500 (Fri, 03 Oct 2008) New Revision: 5904 Modified: branches/clean_math_config/numpy/core/SConscript Log: Remove old configuration checks, supersded by new math config. Modified: branches/clean_math_config/numpy/core/SConscript =================================================================== --- branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:22:18 UTC (rev 5903) +++ branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:22:34 UTC (rev 5904) @@ -186,38 +186,6 @@ """ config.CheckDeclaration(f, includes=includes) -def check_func(f): - """Check that f is available in mlib, and add the symbol appropriately. """ - st = config.CheckDeclaration(f, language = 'C', includes = "#include ") - if st: - st = config.CheckFunc(f, language = 'C') - if st: - mfuncs_defined[f] = 1 - else: - mfuncs_defined[f] = 0 - -for f in mfuncs: - check_func(f) - -if mfuncs_defined['expl'] == 1: - config.Define('HAVE_LONGDOUBLE_FUNCS', - comment = 'Define to 1 if long double funcs are available') -if mfuncs_defined['expf'] == 1: - config.Define('HAVE_FLOAT_FUNCS', - comment = 'Define to 1 if long double funcs are available') -if mfuncs_defined['asinh'] == 1: - config.Define('HAVE_INVERSE_HYPERBOLIC', - comment = 'Define to 1 if inverse hyperbolic funcs are '\ - 'available') -if mfuncs_defined['atanhf'] == 1: - config.Define('HAVE_INVERSE_HYPERBOLIC_FLOAT', - comment = 'Define to 1 if inverse hyperbolic float funcs '\ - 'are available') -if mfuncs_defined['atanhl'] == 1: - config.Define('HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE', - comment = 'Define to 1 if inverse hyperbolic long double '\ - 'funcs are available') - #------------------------------------------------------- # Define the function PyOS_ascii_strod if not available #------------------------------------------------------- From numpy-svn at scipy.org Fri Oct 3 03:23:04 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 3 Oct 2008 02:23:04 -0500 (CDT) Subject: [Numpy-svn] r5905 - branches/clean_math_config/numpy/core Message-ID: <20081003072304.997BF39C088@scipy.org> Author: cdavid Date: 2008-10-03 02:22:57 -0500 (Fri, 03 Oct 2008) New Revision: 5905 Modified: branches/clean_math_config/numpy/core/SConscript Log: Generate math_c99.inc in numscons build. Modified: branches/clean_math_config/numpy/core/SConscript =================================================================== --- branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:22:34 UTC (rev 5904) +++ branches/clean_math_config/numpy/core/SConscript 2008-10-03 07:22:57 UTC (rev 5905) @@ -251,6 +251,7 @@ # Generate generated code #------------------------ scalartypes_src = env.GenerateFromTemplate(pjoin('src', 'scalartypes.inc.src')) +math_c99_src = env.GenerateFromTemplate(pjoin('src', 'math_c99.inc.src')) arraytypes_src = env.GenerateFromTemplate(pjoin('src', 'arraytypes.inc.src')) sortmodule_src = env.GenerateFromTemplate(pjoin('src', '_sortmodule.c.src')) umathmodule_src = env.GenerateFromTemplate(pjoin('src', 'umathmodule.c.src')) From numpy-svn at scipy.org Fri Oct 3 11:55:53 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 3 Oct 2008 10:55:53 -0500 (CDT) Subject: [Numpy-svn] r5906 - in trunk/numpy/core: code_generators src tests Message-ID: <20081003155553.A66F139C088@scipy.org> Author: oliphant Date: 2008-10-03 10:55:52 -0500 (Fri, 03 Oct 2008) New Revision: 5906 Modified: trunk/numpy/core/code_generators/numpy_api_order.txt trunk/numpy/core/src/arrayobject.c trunk/numpy/core/src/multiarraymodule.c trunk/numpy/core/tests/test_multiarray.py Log: Fix ticket #925 Modified: trunk/numpy/core/code_generators/numpy_api_order.txt =================================================================== --- trunk/numpy/core/code_generators/numpy_api_order.txt 2008-10-03 07:22:57 UTC (rev 5905) +++ trunk/numpy/core/code_generators/numpy_api_order.txt 2008-10-03 15:55:52 UTC (rev 5906) @@ -170,3 +170,4 @@ PyArray_CheckAxis PyArray_OverflowMultiplyList PyArray_CompareString +PyArray_MultiIterFromObjects Modified: trunk/numpy/core/src/arrayobject.c =================================================================== --- trunk/numpy/core/src/arrayobject.c 2008-10-03 07:22:57 UTC (rev 5905) +++ trunk/numpy/core/src/arrayobject.c 2008-10-03 15:55:52 UTC (rev 5906) @@ -10790,6 +10790,75 @@ /** END of Subscript Iterator **/ +/* + NUMPY_API + Get MultiIterator from array of Python objects and any additional + + PyObject **mps -- array of PyObjects + int n - number of PyObjects in the array + int nadd - number of additional arrays to include in the + iterator. + + Returns a multi-iterator object. + */ +static PyObject * +PyArray_MultiIterFromObjects(PyObject **mps, int n, int nadd, ...) +{ + va_list va; + PyArrayMultiIterObject *multi; + PyObject *current; + PyObject *arr; + + int i, ntot, err=0; + + ntot = n + nadd; + if (ntot < 2 || ntot > NPY_MAXARGS) { + PyErr_Format(PyExc_ValueError, + "Need between 2 and (%d) " \ + "array objects (inclusive).", NPY_MAXARGS); + return NULL; + } + + multi = _pya_malloc(sizeof(PyArrayMultiIterObject)); + if (multi == NULL) return PyErr_NoMemory(); + PyObject_Init((PyObject *)multi, &PyArrayMultiIter_Type); + + for(i=0; iiters[i] = NULL; + multi->numiter = ntot; + multi->index = 0; + + va_start(va, nadd); + for(i=0; iiters[i] = (PyArrayIterObject *)PyArray_IterNew(arr); + Py_DECREF(arr); + } + } + + va_end(va); + + if (!err && PyArray_Broadcast(multi) < 0) err=1; + + if (err) { + Py_DECREF(multi); + return NULL; + } + + PyArray_MultiIter_RESET(multi); + + return (PyObject *)multi; +} + /*NUMPY_API Get MultiIterator, */ Modified: trunk/numpy/core/src/multiarraymodule.c =================================================================== --- trunk/numpy/core/src/multiarraymodule.c 2008-10-03 07:22:57 UTC (rev 5905) +++ trunk/numpy/core/src/multiarraymodule.c 2008-10-03 15:55:52 UTC (rev 5906) @@ -2326,50 +2326,40 @@ PyArray_Choose(PyArrayObject *ip, PyObject *op, PyArrayObject *ret, NPY_CLIPMODE clipmode) { - intp *sizes, offset; int n, elsize; intp i, m; char *ret_data; PyArrayObject **mps, *ap; - intp *self_data, mi; + PyArrayMultiIterObject *multi=NULL; + intp mi; int copyret=0; ap = NULL; /* Convert all inputs to arrays of a common type */ + /* Also makes them C-contiguous */ mps = PyArray_ConvertToCommonType(op, &n); if (mps == NULL) return NULL; - sizes = (intp *)_pya_malloc(n*sizeof(intp)); - if (sizes == NULL) goto fail; - - ap = (PyArrayObject *)PyArray_ContiguousFromAny((PyObject *)ip, - PyArray_INTP, - 0, 0); - if (ap == NULL) goto fail; - - /* Check the dimensions of the arrays */ for(i=0; ind < mps[i]->nd) { - PyErr_SetString(PyExc_ValueError, - "too many dimensions"); - goto fail; - } - if (!PyArray_CompareLists(ap->dimensions+(ap->nd-mps[i]->nd), - mps[i]->dimensions, mps[i]->nd)) { - PyErr_SetString(PyExc_ValueError, - "array dimensions must agree"); - goto fail; - } - sizes[i] = PyArray_NBYTES(mps[i]); } + ap = (PyArrayObject *)PyArray_FROM_OT((PyObject *)ip, NPY_INTP); + + if (ap == NULL) goto fail; + + /* Broadcast all arrays to each other, index array at the end. */ + multi = (PyArrayMultiIterObject *)\ + PyArray_MultiIterFromObjects((PyObject **)mps, n, 1, ap); + if (multi == NULL) goto fail; + + /* Set-up return array */ if (!ret) { Py_INCREF(mps[0]->descr); ret = (PyArrayObject *)PyArray_NewFromDescr(ap->ob_type, mps[0]->descr, - ap->nd, - ap->dimensions, + multi->nd, + multi->dimensions, NULL, NULL, 0, (PyObject *)ap); } @@ -2377,8 +2367,10 @@ PyArrayObject *obj; int flags = NPY_CARRAY | NPY_UPDATEIFCOPY | NPY_FORCECAST; - if (PyArray_SIZE(ret) != PyArray_SIZE(ap)) { - PyErr_SetString(PyExc_TypeError, + if ((PyArray_NDIM(ret) != multi->nd) || + !PyArray_CompareLists(PyArray_DIMS(ret), multi->dimensions, + multi->nd)) { + PyErr_SetString(PyExc_TypeError, "invalid shape for output array."); ret = NULL; goto fail; @@ -2399,12 +2391,10 @@ if (ret == NULL) goto fail; elsize = ret->descr->elsize; - m = PyArray_SIZE(ret); - self_data = (intp *)ap->data; ret_data = ret->data; - for (i=0; i= n) { switch(clipmode) { case NPY_RAISE: @@ -2426,17 +2416,16 @@ break; } } - offset = i*elsize; - if (offset >= sizes[mi]) {offset = offset % sizes[mi]; } - memmove(ret_data, mps[mi]->data+offset, elsize); - ret_data += elsize; self_data++; + memmove(ret_data, PyArray_MultiIter_DATA(multi, mi), elsize); + ret_data += elsize; + PyArray_MultiIter_NEXT(multi); } PyArray_INCREF(ret); + Py_DECREF(multi); for(i=0; ibase; @@ -2447,10 +2436,10 @@ return (PyObject *)ret; fail: + Py_XDECREF(multi); for(i=0; i Author: charris Date: 2008-10-03 20:02:11 -0500 (Fri, 03 Oct 2008) New Revision: 5907 Added: branches/ufunc_cleanup/numpy/core/include/numpy/WTF_MathExtras.h Modified: branches/ufunc_cleanup/numpy/core/src/ufuncobject.c branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src branches/ufunc_cleanup/numpy/core/tests/test_umath.py branches/ufunc_cleanup/numpy/distutils/command/scons.py branches/ufunc_cleanup/tools/win32build/doall.py Log: Update to trunk. Add WTF_MathExtras.h from Apple to see if it fixes some windows problems. Added: branches/ufunc_cleanup/numpy/core/include/numpy/WTF_MathExtras.h =================================================================== --- branches/ufunc_cleanup/numpy/core/include/numpy/WTF_MathExtras.h 2008-10-03 15:55:52 UTC (rev 5906) +++ branches/ufunc_cleanup/numpy/core/include/numpy/WTF_MathExtras.h 2008-10-04 01:02:11 UTC (rev 5907) @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. + */ + + +#ifndef WTF_MathExtras_h +#define WTF_MathExtras_h + +#include +#include +#include + +#if defined (__SVR4) && defined (__sun) && defined (__GNUC__) + +#include + +#endif + +#if defined(_MSC_VER) + +#include +#include + +#if HAVE(FLOAT_H) +#include +#endif + +#endif + +#ifndef M_PI +const double piDouble = 3.14159265358979323846; +const float piFloat = 3.14159265358979323846f; +#else +const double piDouble = M_PI; +const float piFloat = (float)M_PI; +#endif + +#ifndef M_PI_4 +const double piOverFourDouble = 0.785398163397448309616; +const float piOverFourFloat = 0.785398163397448309616f; +#else +const double piOverFourDouble = M_PI_4; +const float piOverFourFloat = (float)M_PI_4; +#endif + +#if defined (__SVR4) && defined (__sun) && defined (__GNUC__) + +#ifndef isfinite +#define isfinite(x) (finite(x) && !isnand(x)) +#endif +#ifndef isinf +#define isinf(x) (!finite(x) && !isnand(x)) +#endif +#ifndef signbit +#define signbit(x) (x < 0.0) /* FIXME: Wrong for negative 0. */ +#endif + +#endif + +#if defined(_MSC_VER) + +#define isinf(num) ( !_finite(num) && !_isnan(num) ) +#define isnan(num) ( !!_isnan(num) ) +/* +#define lround(num) ( (long)(num > 0 ? num + 0.5 : ceil(num - 0.5)) ) +#define lroundf(num) ( (long)(num > 0 ? num + 0.5f : ceilf(num - 0.5f)) ) +#define round(num) ( num > 0 ? floor(num + 0.5) : ceil(num - 0.5) ) +#define roundf(num) ( num > 0 ? floorf(num + 0.5f) : ceilf(num - 0.5f) ) +*/ +#define signbit(num) ( _copysign(1.0, num) < 0 ) +#define trunc(num) ( num > 0 ? floor(num) : ceil(num) ) +#define nextafter(x, y) ( _nextafter(x, y) ) +#define nextafterf(x, y) ( x > y ? x - FLT_EPSILON : x + FLT_EPSILON ) +#define copysign(x, y) ( _copysign(x, y) ) +#define isfinite(x) ( _finite(x) ) + +/* + * Work around a bug in Win, where atan2(+-infinity, +-infinity) + * yields NaN instead of specific values. + */ +/* +double +wtf_atan2(double x, double y) +{ + static double posInf = std::numeric_limits::infinity(); + static double negInf = -std::numeric_limits::infinity(); + static double nan = std::numeric_limits::quiet_NaN(); + + + double result = nan; + + if (x == posInf && y == posInf) + result = piOverFourDouble; + else if (x == posInf && y == negInf) + result = 3 * piOverFourDouble; + else if (x == negInf && y == posInf) + + result = -piOverFourDouble; + else if (x == negInf && y == negInf) + result = -3 * piOverFourDouble; + else + result = ::atan2(x, y); + + return result; +} +*/ + +/* + * Work around a bug in the Microsoft CRT, where fmod(x, +-infinity) + * yields NaN instead of x. + */ +#define wtf_fmod(x, y) ( (!isinf(x) && isinf(y)) ? x : fmod(x, y) ) + +/* + * Work around a bug in the Microsoft CRT, where pow(NaN, 0) + * yields NaN instead of 1. + */ +#define wtf_pow(x, y) ( y == 0 ? 1 : pow(x, y) ) + +/* +#define atan2(x, y) wtf_atan2(x, y) +*/ +#define fmod(x, y) wtf_fmod(x, y) +#define pow(x, y) wtf_pow(x, y) + +#endif /* COMPILER(MSVC) */ + + +#define deg2rad(d) ( d * piDouble / 180.0 ) +#define rad2deg(r) ( r * 180.0 / piDouble ) +#define deg2grad(d) ( d * 400.0 / 360.0 ) +#define grad2deg(g) ( g * 360.0 / 400.0 ) +#define rad2grad(r) ( r * 200.0 / piDouble ) +#define grad2rad(g) ( g * piDouble / 200.0 ) + +#define deg2radf(d) ( d * piFloat / 180.0f ) +#define rad2degf(r) ( r * 180.0f / piFloat ) +#define deg2gradf(d) ( d * 400.0f / 360.0f ) +#define grad2degf(g) ( g * 360.0f / 400.0f ) +#define rad2gradf(r) ( r * 200.0f / piFloat ) +#define grad2radf(g) ( g * piFloat / 200.0f ) + + +#endif /* #ifndef WTF_MathExtras_h */ Modified: branches/ufunc_cleanup/numpy/core/src/ufuncobject.c =================================================================== --- branches/ufunc_cleanup/numpy/core/src/ufuncobject.c 2008-10-03 15:55:52 UTC (rev 5906) +++ branches/ufunc_cleanup/numpy/core/src/ufuncobject.c 2008-10-04 01:02:11 UTC (rev 5907) @@ -1427,12 +1427,15 @@ * FAIL with NotImplemented if the other object has * the __r__ method and has __array_priority__ as * an attribute (signalling it can handle ndarray's) - * and is not already an ndarray + * and is not already an ndarray or a subtype of the same type. */ if ((arg_types[1] == PyArray_OBJECT) && \ (loop->ufunc->nin==2) && (loop->ufunc->nout == 1)) { PyObject *_obj = PyTuple_GET_ITEM(args, 1); - if (!PyArray_CheckExact(_obj) && \ + if (!PyArray_CheckExact(_obj) && + /* If both are same subtype of object arrays, then proceed */ + !(_obj->ob_type == (PyTuple_GET_ITEM(args, 0))->ob_type) && \ + PyObject_HasAttrString(_obj, "__array_priority__") && \ _has_reflected_op(_obj, loop->ufunc->name)) { loop->notimplemented = 1; Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-03 15:55:52 UTC (rev 5906) +++ branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-04 01:02:11 UTC (rev 5907) @@ -16,6 +16,7 @@ #include "abstract.h" #include "config.h" #include +#include "numpy/WTF_MathExtras.h" #ifndef M_PI #define M_PI 3.14159265358979323846264338328 @@ -47,7 +48,7 @@ return x * (M_PI/180.0L); } -/* +/* * A whole slew of basic math functions are provided originally * by Konrad Hinsen. */ Modified: branches/ufunc_cleanup/numpy/core/tests/test_umath.py =================================================================== --- branches/ufunc_cleanup/numpy/core/tests/test_umath.py 2008-10-03 15:55:52 UTC (rev 5906) +++ branches/ufunc_cleanup/numpy/core/tests/test_umath.py 2008-10-04 01:02:11 UTC (rev 5907) @@ -281,6 +281,16 @@ assert_equal(add.nout, 1) assert_equal(add.identity, 0) +class TestSubclass(TestCase): + def test_subclass_op(self): + class simple(np.ndarray): + def __new__(subtype, shape): + self = np.ndarray.__new__(subtype, shape, dtype=object) + self.fill(0) + return self + a = simple((3,4)) + assert_equal(a+a, a) + def _check_branch_cut(f, x0, dx, re_sign=1, im_sign=-1, sig_zero_ok=False, dtype=np.complex): """ Modified: branches/ufunc_cleanup/numpy/distutils/command/scons.py =================================================================== --- branches/ufunc_cleanup/numpy/distutils/command/scons.py 2008-10-03 15:55:52 UTC (rev 5906) +++ branches/ufunc_cleanup/numpy/distutils/command/scons.py 2008-10-04 01:02:11 UTC (rev 5907) @@ -360,7 +360,7 @@ "this package " % str(e)) try: - minver = "0.9.1" + minver = "0.9.3" from numscons import get_version if get_version() < minver: raise ValueError() Modified: branches/ufunc_cleanup/tools/win32build/doall.py =================================================================== --- branches/ufunc_cleanup/tools/win32build/doall.py 2008-10-03 15:55:52 UTC (rev 5906) +++ branches/ufunc_cleanup/tools/win32build/doall.py 2008-10-04 01:02:11 UTC (rev 5907) @@ -1,13 +1,25 @@ import subprocess import os -PYVER = "2.5" +if __name__ == '__main__': + from optparse import OptionParser + parser = OptionParser() + parser.add_option("-p", "--pyver", dest="pyver", + help = "Python version (2.4, 2.5, etc...)") -# Bootstrap -subprocess.check_call(['python', 'prepare_bootstrap.py', '-p', PYVER]) + opts, args = parser.parse_args() + pyver = opts.pyver -# Build binaries -subprocess.check_call(['python', 'build.py', '-p', PYVER], cwd = 'bootstrap-%s' % PYVER) + if not pyver: + pyver = "2.5" -# Build installer using nsis -subprocess.check_call(['makensis', 'numpy-superinstaller.nsi'], cwd = 'bootstrap-%s' % PYVER) + # Bootstrap + subprocess.check_call(['python', 'prepare_bootstrap.py', '-p', pyver]) + + # Build binaries + subprocess.check_call(['python', 'build.py', '-p', pyver], + cwd = 'bootstrap-%s' % pyver) + + # Build installer using nsis + subprocess.check_call(['makensis', 'numpy-superinstaller.nsi'], + cwd = 'bootstrap-%s' % pyver) From numpy-svn at scipy.org Fri Oct 3 21:55:00 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 3 Oct 2008 20:55:00 -0500 (CDT) Subject: [Numpy-svn] r5908 - branches/ufunc_cleanup/numpy/core/include/numpy Message-ID: <20081004015500.8794A39C088@scipy.org> Author: charris Date: 2008-10-03 20:54:58 -0500 (Fri, 03 Oct 2008) New Revision: 5908 Modified: branches/ufunc_cleanup/numpy/core/include/numpy/WTF_MathExtras.h Log: Try include fix in WTF_MathExtras.h file Modified: branches/ufunc_cleanup/numpy/core/include/numpy/WTF_MathExtras.h =================================================================== --- branches/ufunc_cleanup/numpy/core/include/numpy/WTF_MathExtras.h 2008-10-04 01:02:11 UTC (rev 5907) +++ branches/ufunc_cleanup/numpy/core/include/numpy/WTF_MathExtras.h 2008-10-04 01:54:58 UTC (rev 5908) @@ -45,7 +45,7 @@ #if defined(_MSC_VER) #include -#include +#include #if HAVE(FLOAT_H) #include From numpy-svn at scipy.org Sun Oct 5 01:19:55 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 00:19:55 -0500 (CDT) Subject: [Numpy-svn] r5909 - in branches/ufunc_cleanup/numpy/core: code_generators include/numpy Message-ID: <20081005051955.A25F539C088@scipy.org> Author: charris Date: 2008-10-05 00:19:52 -0500 (Sun, 05 Oct 2008) New Revision: 5909 Modified: branches/ufunc_cleanup/numpy/core/code_generators/generate_umath.py branches/ufunc_cleanup/numpy/core/include/numpy/ufuncobject.h Log: Fix invalid use of identity fmax,fmin. Modified: branches/ufunc_cleanup/numpy/core/code_generators/generate_umath.py =================================================================== --- branches/ufunc_cleanup/numpy/core/code_generators/generate_umath.py 2008-10-04 01:54:58 UTC (rev 5908) +++ branches/ufunc_cleanup/numpy/core/code_generators/generate_umath.py 2008-10-05 05:19:52 UTC (rev 5909) @@ -6,7 +6,6 @@ Zero = "PyUFunc_Zero" One = "PyUFunc_One" -Nan = "PyUFunc_Nan" None_ = "PyUFunc_None" class TypeDescription(object): @@ -318,14 +317,14 @@ TD(O, f='_npy_ObjectMin') ), 'fmax' : - Ufunc(2, 1, Nan, + Ufunc(2, 1, None, "", - TD(inexact), + TD(inexact) ), 'fmin' : - Ufunc(2, 1, Nan, + Ufunc(2, 1, None, "", - TD(inexact), + TD(inexact) ), 'bitwise_and' : Ufunc(2, 1, One, Modified: branches/ufunc_cleanup/numpy/core/include/numpy/ufuncobject.h =================================================================== --- branches/ufunc_cleanup/numpy/core/include/numpy/ufuncobject.h 2008-10-04 01:54:58 UTC (rev 5908) +++ branches/ufunc_cleanup/numpy/core/include/numpy/ufuncobject.h 2008-10-05 05:19:52 UTC (rev 5909) @@ -184,7 +184,6 @@ #define PyUFunc_One 1 #define PyUFunc_Zero 0 #define PyUFunc_None -1 -#define PyUFunc_Nan NAN #define UFUNC_REDUCE 0 #define UFUNC_ACCUMULATE 1 From numpy-svn at scipy.org Sun Oct 5 01:29:11 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 00:29:11 -0500 (CDT) Subject: [Numpy-svn] r5910 - branches/ufunc_cleanup/numpy/core/src Message-ID: <20081005052911.697ED39C088@scipy.org> Author: charris Date: 2008-10-05 00:29:09 -0500 (Sun, 05 Oct 2008) New Revision: 5910 Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src Log: Cleanup some floating constant types. Make cast from double explicit for integer kind reciprocal. Small style cleanup. Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-05 05:19:52 UTC (rev 5909) +++ branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-05 05:29:09 UTC (rev 5910) @@ -1243,7 +1243,7 @@ { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; - *((@s@@type@ *)op) = 1.0/in1; + *((@s@@type@ *)op) = (@s@@type@)(1.0/in1); } } @@ -1513,6 +1513,9 @@ * #C = F, , L# */ +#define ONE 1.0 at c@ +#define ZERO 0.0 at c@ + /**begin repeat1 * Arithmetic * # kind = add, subtract, multiply, divide# @@ -1650,7 +1653,7 @@ { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; - *((@type@ *)op) = 1.0/in1; + *((@type@ *)op) = ONE/in1; } } @@ -1658,7 +1661,7 @@ @TYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *data) { OUTPUT_LOOP { - *((@type@ *)op) = 1; + *((@type@ *)op) = ONE; } } @@ -1676,7 +1679,7 @@ { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; - const @type@ tmp = (in1 > 0) ? in1 : -in1; + const @type@ tmp = in1 > 0 ? in1 : -in1; /* add 0 to clear -0.0 */ *((@type@ *)op) = tmp + 0; } @@ -1697,7 +1700,7 @@ /* */ UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; - *((@type@ *)op) = in1 > 0 ? 1 : (in1 < 0 ? -1 : 0); + *((@type@ *)op) = in1 > 0 ? ONE : (in1 < 0 ? -ONE : ZERO); } } @@ -1734,6 +1737,8 @@ #undef HAVE_DOUBLE_FUNCS #define @TYPE at _true_divide @TYPE at _divide +#undef ONE +#undef ZERO /**end repeat**/ From numpy-svn at scipy.org Sun Oct 5 01:36:59 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 00:36:59 -0500 (CDT) Subject: [Numpy-svn] r5911 - branches/ufunc_cleanup/numpy/core/src Message-ID: <20081005053659.B509739C088@scipy.org> Author: charris Date: 2008-10-05 00:36:57 -0500 (Sun, 05 Oct 2008) New Revision: 5911 Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src Log: More constant type cleanups. USE CLE,CGE for complex compare macros instead of LE & GE. Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-05 05:29:09 UTC (rev 5910) +++ branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-05 05:36:57 UTC (rev 5911) @@ -1737,6 +1737,7 @@ #undef HAVE_DOUBLE_FUNCS #define @TYPE at _true_divide @TYPE at _divide + #undef ONE #undef ZERO @@ -1757,6 +1758,11 @@ * #c = f, , l# */ +#define CGE(xr,xi,yr,yi) (xr > yr || (xr == yr && xi >= yi)) +#define CLE(xr,xi,yr,yi) (xr < yr || (xr == yr && xi <= yi)) +#define ONE 1.0 at c@ +#define ZERO 0.0 at c@ + /**begin repeat1 * arithmetic * #kind = add, subtract# @@ -1950,8 +1956,8 @@ @CTYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *data) { OUTPUT_LOOP { - ((@type@ *)op)[0] = 1; - ((@type@ *)op)[1] = 0; + ((@type@ *)op)[0] = ONE; + ((@type@ *)op)[1] = ZERO; } } @@ -1982,32 +1988,30 @@ const @type@ in1r = ((@type@ *)ip1)[0]; const @type@ in1i = ((@type@ *)ip1)[1]; if (in1r > 0) { - ((@type@ *)op)[0] = 1; + ((@type@ *)op)[0] = ONE; } else if (in1r < 0) { - ((@type@ *)op)[0] = -1; + ((@type@ *)op)[0] = -ONE; } else { if (in1i > 0) { - ((@type@ *)op)[0] = 1; + ((@type@ *)op)[0] = ONE; } else if (in1i < 0) { - ((@type@ *)op)[0] = -1; + ((@type@ *)op)[0] = -ONE; } else { - ((@type@ *)op)[0] = 0; + ((@type@ *)op)[0] = ZERO; } } - ((@type@ *)op)[1] = 0; + ((@type@ *)op)[1] = ZERO; } } -#define GE(xr,xi,yr,yi) (xr > yr || (xr == yr && xi >= yi)) -#define LE(xr,xi,yr,yi) (xr < yr || (xr == yr && xi <= yi)) /**begin repeat1 * #kind = maximum, minimum# - * #OP1 = GE, LE# - * #OP2 = LE, GE# + * #OP1 = CGE, CLE# + * #OP2 = CLE, CGE# */ static void @CTYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) @@ -2035,7 +2039,7 @@ /**begin repeat1 * #kind = fmax, fmin# - * #OP1 = GE, LE# + * #OP1 = CGE, CLE# */ static void @CTYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) @@ -2062,10 +2066,14 @@ } } /**end repeat1**/ -#undef GE -#undef LE #define @CTYPE at _true_divide @CTYPE at _divide + +#undef CGE +#undef CLE +#undef ONE +#undef ZERO + /**end repeat**/ From numpy-svn at scipy.org Sun Oct 5 03:00:52 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 02:00:52 -0500 (CDT) Subject: [Numpy-svn] r5912 - in branches/clean_math_config: . numpy/core/code_generators numpy/core/src numpy/core/tests numpy/distutils/command tools/win32build Message-ID: <20081005070052.DDA2E39C088@scipy.org> Author: cdavid Date: 2008-10-05 02:00:33 -0500 (Sun, 05 Oct 2008) New Revision: 5912 Modified: branches/clean_math_config/ branches/clean_math_config/numpy/core/code_generators/numpy_api_order.txt branches/clean_math_config/numpy/core/src/arrayobject.c branches/clean_math_config/numpy/core/src/multiarraymodule.c branches/clean_math_config/numpy/core/src/ufuncobject.c branches/clean_math_config/numpy/core/src/umathmodule.c.src branches/clean_math_config/numpy/core/tests/test_multiarray.py branches/clean_math_config/numpy/core/tests/test_umath.py branches/clean_math_config/numpy/distutils/command/scons.py branches/clean_math_config/tools/win32build/doall.py Log: Merged revisions 5882-5911 via svnmerge from http://svn.scipy.org/svn/numpy/trunk ........ r5886 | charris | 2008-10-02 03:05:29 +0900 (Thu, 02 Oct 2008) | 4 lines Make some error messages more informative. Improve error handling. Make continuation lines work. ........ r5887 | charris | 2008-10-02 03:06:04 +0900 (Thu, 02 Oct 2008) | 2 lines Small cleanup to clarify repeated string. ........ r5888 | charris | 2008-10-02 03:08:41 +0900 (Thu, 02 Oct 2008) | 6 lines Cleanup ufunc loops. At this point loops are separated into variable kinds, so there is a fair amount of duplication. I will probably merge loops that look the same in a later commit. There are no changes to current behavior of loops, this will also be changed in later work to deal with nans and such. ........ r5889 | oliphant | 2008-10-03 05:27:17 +0900 (Fri, 03 Oct 2008) | 1 line Fix problem with subclasses of object arrays. ........ r5896 | cdavid | 2008-10-03 15:50:32 +0900 (Fri, 03 Oct 2008) | 1 line Update the minimum version for numscons: had to change to cope with Chuck changes to conv_template.py. ........ r5897 | cdavid | 2008-10-03 15:51:03 +0900 (Fri, 03 Oct 2008) | 1 line Update doall script: take the python version to build binaries from the command line instead of global variable. ........ r5906 | oliphant | 2008-10-04 00:55:52 +0900 (Sat, 04 Oct 2008) | 1 line Fix ticket #925 ........ Property changes on: branches/clean_math_config ___________________________________________________________________ Name: svnmerge-integrated - /branches/aligned_alloca:1-5127 /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /cleaned_math_config:1-5731 /trunk:1-5881 + /branches/aligned_alloca:1-5127 /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /cleaned_math_config:1-5731 /trunk:1-5911 Modified: branches/clean_math_config/numpy/core/code_generators/numpy_api_order.txt =================================================================== --- branches/clean_math_config/numpy/core/code_generators/numpy_api_order.txt 2008-10-05 05:36:57 UTC (rev 5911) +++ branches/clean_math_config/numpy/core/code_generators/numpy_api_order.txt 2008-10-05 07:00:33 UTC (rev 5912) @@ -170,3 +170,4 @@ PyArray_CheckAxis PyArray_OverflowMultiplyList PyArray_CompareString +PyArray_MultiIterFromObjects Modified: branches/clean_math_config/numpy/core/src/arrayobject.c =================================================================== --- branches/clean_math_config/numpy/core/src/arrayobject.c 2008-10-05 05:36:57 UTC (rev 5911) +++ branches/clean_math_config/numpy/core/src/arrayobject.c 2008-10-05 07:00:33 UTC (rev 5912) @@ -10790,6 +10790,75 @@ /** END of Subscript Iterator **/ +/* + NUMPY_API + Get MultiIterator from array of Python objects and any additional + + PyObject **mps -- array of PyObjects + int n - number of PyObjects in the array + int nadd - number of additional arrays to include in the + iterator. + + Returns a multi-iterator object. + */ +static PyObject * +PyArray_MultiIterFromObjects(PyObject **mps, int n, int nadd, ...) +{ + va_list va; + PyArrayMultiIterObject *multi; + PyObject *current; + PyObject *arr; + + int i, ntot, err=0; + + ntot = n + nadd; + if (ntot < 2 || ntot > NPY_MAXARGS) { + PyErr_Format(PyExc_ValueError, + "Need between 2 and (%d) " \ + "array objects (inclusive).", NPY_MAXARGS); + return NULL; + } + + multi = _pya_malloc(sizeof(PyArrayMultiIterObject)); + if (multi == NULL) return PyErr_NoMemory(); + PyObject_Init((PyObject *)multi, &PyArrayMultiIter_Type); + + for(i=0; iiters[i] = NULL; + multi->numiter = ntot; + multi->index = 0; + + va_start(va, nadd); + for(i=0; iiters[i] = (PyArrayIterObject *)PyArray_IterNew(arr); + Py_DECREF(arr); + } + } + + va_end(va); + + if (!err && PyArray_Broadcast(multi) < 0) err=1; + + if (err) { + Py_DECREF(multi); + return NULL; + } + + PyArray_MultiIter_RESET(multi); + + return (PyObject *)multi; +} + /*NUMPY_API Get MultiIterator, */ Modified: branches/clean_math_config/numpy/core/src/multiarraymodule.c =================================================================== --- branches/clean_math_config/numpy/core/src/multiarraymodule.c 2008-10-05 05:36:57 UTC (rev 5911) +++ branches/clean_math_config/numpy/core/src/multiarraymodule.c 2008-10-05 07:00:33 UTC (rev 5912) @@ -2326,50 +2326,40 @@ PyArray_Choose(PyArrayObject *ip, PyObject *op, PyArrayObject *ret, NPY_CLIPMODE clipmode) { - intp *sizes, offset; int n, elsize; intp i, m; char *ret_data; PyArrayObject **mps, *ap; - intp *self_data, mi; + PyArrayMultiIterObject *multi=NULL; + intp mi; int copyret=0; ap = NULL; /* Convert all inputs to arrays of a common type */ + /* Also makes them C-contiguous */ mps = PyArray_ConvertToCommonType(op, &n); if (mps == NULL) return NULL; - sizes = (intp *)_pya_malloc(n*sizeof(intp)); - if (sizes == NULL) goto fail; - - ap = (PyArrayObject *)PyArray_ContiguousFromAny((PyObject *)ip, - PyArray_INTP, - 0, 0); - if (ap == NULL) goto fail; - - /* Check the dimensions of the arrays */ for(i=0; ind < mps[i]->nd) { - PyErr_SetString(PyExc_ValueError, - "too many dimensions"); - goto fail; - } - if (!PyArray_CompareLists(ap->dimensions+(ap->nd-mps[i]->nd), - mps[i]->dimensions, mps[i]->nd)) { - PyErr_SetString(PyExc_ValueError, - "array dimensions must agree"); - goto fail; - } - sizes[i] = PyArray_NBYTES(mps[i]); } + ap = (PyArrayObject *)PyArray_FROM_OT((PyObject *)ip, NPY_INTP); + + if (ap == NULL) goto fail; + + /* Broadcast all arrays to each other, index array at the end. */ + multi = (PyArrayMultiIterObject *)\ + PyArray_MultiIterFromObjects((PyObject **)mps, n, 1, ap); + if (multi == NULL) goto fail; + + /* Set-up return array */ if (!ret) { Py_INCREF(mps[0]->descr); ret = (PyArrayObject *)PyArray_NewFromDescr(ap->ob_type, mps[0]->descr, - ap->nd, - ap->dimensions, + multi->nd, + multi->dimensions, NULL, NULL, 0, (PyObject *)ap); } @@ -2377,8 +2367,10 @@ PyArrayObject *obj; int flags = NPY_CARRAY | NPY_UPDATEIFCOPY | NPY_FORCECAST; - if (PyArray_SIZE(ret) != PyArray_SIZE(ap)) { - PyErr_SetString(PyExc_TypeError, + if ((PyArray_NDIM(ret) != multi->nd) || + !PyArray_CompareLists(PyArray_DIMS(ret), multi->dimensions, + multi->nd)) { + PyErr_SetString(PyExc_TypeError, "invalid shape for output array."); ret = NULL; goto fail; @@ -2399,12 +2391,10 @@ if (ret == NULL) goto fail; elsize = ret->descr->elsize; - m = PyArray_SIZE(ret); - self_data = (intp *)ap->data; ret_data = ret->data; - for (i=0; i= n) { switch(clipmode) { case NPY_RAISE: @@ -2426,17 +2416,16 @@ break; } } - offset = i*elsize; - if (offset >= sizes[mi]) {offset = offset % sizes[mi]; } - memmove(ret_data, mps[mi]->data+offset, elsize); - ret_data += elsize; self_data++; + memmove(ret_data, PyArray_MultiIter_DATA(multi, mi), elsize); + ret_data += elsize; + PyArray_MultiIter_NEXT(multi); } PyArray_INCREF(ret); + Py_DECREF(multi); for(i=0; ibase; @@ -2447,10 +2436,10 @@ return (PyObject *)ret; fail: + Py_XDECREF(multi); for(i=0; i__ method and has __array_priority__ as * an attribute (signalling it can handle ndarray's) - * and is not already an ndarray + * and is not already an ndarray or a subtype of the same type. */ if ((arg_types[1] == PyArray_OBJECT) && \ (loop->ufunc->nin==2) && (loop->ufunc->nout == 1)) { PyObject *_obj = PyTuple_GET_ITEM(args, 1); - if (!PyArray_CheckExact(_obj) && \ + if (!PyArray_CheckExact(_obj) && + /* If both are same subtype of object arrays, then proceed */ + !(_obj->ob_type == (PyTuple_GET_ITEM(args, 0))->ob_type) && \ + PyObject_HasAttrString(_obj, "__array_priority__") && \ _has_reflected_op(_obj, loop->ufunc->name)) { loop->notimplemented = 1; Modified: branches/clean_math_config/numpy/core/src/umathmodule.c.src =================================================================== --- branches/clean_math_config/numpy/core/src/umathmodule.c.src 2008-10-05 05:36:57 UTC (rev 5911) +++ branches/clean_math_config/numpy/core/src/umathmodule.c.src 2008-10-05 07:00:33 UTC (rev 5912) @@ -20,6 +20,7 @@ #ifndef M_PI #define M_PI 3.14159265358979323846264338328 #endif + #include "math_c99.inc" float degreesf(float x) { @@ -44,16 +45,73 @@ /* ***************************************************************************** + ** PYTHON OBJECT FUNCTIONS ** + ***************************************************************************** + */ + +static PyObject * +Py_square(PyObject *o) +{ + return PyNumber_Multiply(o, o); +} + +static PyObject * +Py_get_one(PyObject *o) +{ + return PyInt_FromLong(1); +} + +static PyObject * +Py_reciprocal(PyObject *o) +{ + PyObject *one = PyInt_FromLong(1); + PyObject *result; + + if (!one) { + return NULL; + } + result = PyNumber_Divide(one, o); + Py_DECREF(one); + return result; +} + +/**begin repeat + * #Kind = Max, Min# + * #OP = >=, <=# + */ +static PyObject * +_npy_Object at Kind@(PyObject *i1, PyObject *i2) +{ + PyObject *result; + int cmp; + + if (PyObject_Cmp(i1, i2, &cmp) < 0) { + return NULL; + } + if (cmp @OP@ 0) { + result = i1; + } + else { + result = i2; + } + Py_INCREF(result); + return result; +} +/**end repeat**/ + +/* + ***************************************************************************** ** COMPLEX FUNCTIONS ** ***************************************************************************** */ -/* Don't pass structures between functions (only pointers) because how - structures are passed is compiler dependent and could cause - segfaults if ufuncobject.c is compiled with a different compiler - than an extension that makes use of the UFUNC API -*/ +/* + * Don't pass structures between functions (only pointers) because how + * structures are passed is compiler dependent and could cause + * segfaults if ufuncobject.c is compiled with a different compiler + * than an extension that makes use of the UFUNC API + */ /**begin repeat @@ -67,10 +125,11 @@ static c at typ@ nc_i at c@ = {0., 1.}; static c at typ@ nc_i2 at c@ = {0., 0.5}; /* - static c at typ@ nc_mi at c@ = {0., -1.}; - static c at typ@ nc_pi2 at c@ = {M_PI/2., 0.}; -*/ + * static c at typ@ nc_mi at c@ = {0., -1.}; + * static c at typ@ nc_pi2 at c@ = {M_PI/2., 0.}; + */ + static void nc_sum at c@(c at typ@ *a, c at typ@ *b, c at typ@ *r) { @@ -98,7 +157,7 @@ static void nc_prod at c@(c at typ@ *a, c at typ@ *b, c at typ@ *r) { - register @typ@ ar=a->real, br=b->real, ai=a->imag, bi=b->imag; + @typ@ ar=a->real, br=b->real, ai=a->imag, bi=b->imag; r->real = ar*br - ai*bi; r->imag = ar*bi + ai*br; return; @@ -108,8 +167,8 @@ nc_quot at c@(c at typ@ *a, c at typ@ *b, c at typ@ *r) { - register @typ@ ar=a->real, br=b->real, ai=a->imag, bi=b->imag; - register @typ@ d = br*br + bi*bi; + @typ@ ar=a->real, br=b->real, ai=a->imag, bi=b->imag; + @typ@ d = br*br + bi*bi; r->real = (ar*br + ai*bi)/d; r->imag = (ai*br - ar*bi)/d; return; @@ -218,8 +277,10 @@ return; } } - /* complexobect.c uses an inline version of this formula - investigate whether this had better performance or accuracy */ + /* + * complexobect.c uses an inline version of this formula + * investigate whether this had better performance or accuracy + */ nc_log at c@(a, r); nc_prod at c@(r, b, r); nc_exp at c@(r, r); @@ -240,6 +301,10 @@ static void nc_acos at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_neg(nc_prodi(nc_log(nc_sum(x,nc_prod(nc_i, + * nc_sqrt(nc_diff(nc_1,nc_prod(x,x)))))))); + */ nc_prod at c@(x,x,r); nc_diff at c@(&nc_1 at c@, r, r); nc_sqrt at c@(r, r); @@ -249,14 +314,15 @@ nc_prodi at c@(r, r); nc_neg at c@(r, r); return; - /* return nc_neg(nc_prodi(nc_log(nc_sum(x,nc_prod(nc_i, - nc_sqrt(nc_diff(nc_1,nc_prod(x,x)))))))); - */ } static void nc_acosh at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_log(nc_sum(x, + * nc_prod(nc_sqrt(nc_sum(x,nc_1)), nc_sqrt(nc_diff(x,nc_1))))); + */ c at typ@ t; nc_sum at c@(x, &nc_1 at c@, &t); @@ -267,15 +333,15 @@ nc_sum at c@(x, r, r); nc_log at c@(r, r); return; - /* - return nc_log(nc_sum(x, - nc_prod(nc_sqrt(nc_sum(x,nc_1)), nc_sqrt(nc_diff(x,nc_1))))); - */ } static void nc_asin at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_neg(nc_prodi(nc_log(nc_sum(nc_prod(nc_i,x), + * nc_sqrt(nc_diff(nc_1,nc_prod(x,x))))))); + */ c at typ@ a, *pa=&a; nc_prod at c@(x, x, r); nc_diff at c@(&nc_1 at c@, r, r); @@ -286,30 +352,29 @@ nc_prodi at c@(r, r); nc_neg at c@(r, r); return; - /* - return nc_neg(nc_prodi(nc_log(nc_sum(nc_prod(nc_i,x), - nc_sqrt(nc_diff(nc_1,nc_prod(x,x))))))); - */ } static void nc_asinh at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_log(nc_sum(nc_sqrt(nc_sum(nc_1,nc_prod(x,x))),x)); + */ nc_prod at c@(x, x, r); nc_sum at c@(&nc_1 at c@, r, r); nc_sqrt at c@(r, r); nc_sum at c@(r, x, r); nc_log at c@(r, r); return; - /* - return nc_log(nc_sum(nc_sqrt(nc_sum(nc_1,nc_prod(x,x))),x)); - */ } static void nc_atan at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_prod(nc_i2,nc_log(nc_quot(nc_sum(nc_i,x),nc_diff(nc_i,x)))); + */ c at typ@ a, *pa=&a; nc_diff at c@(&nc_i at c@, x, pa); nc_sum at c@(&nc_i at c@, x, r); @@ -317,14 +382,14 @@ nc_log at c@(r,r); nc_prod at c@(&nc_i2 at c@, r, r); return; - /* - return nc_prod(nc_i2,nc_log(nc_quot(nc_sum(nc_i,x),nc_diff(nc_i,x)))); - */ } static void nc_atanh at c@(c at typ@ *x, c at typ@ *r) { + /* + * return nc_prod(nc_half,nc_log(nc_quot(nc_sum(nc_1,x),nc_diff(nc_1,x)))); + */ c at typ@ a, *pa=&a; nc_diff at c@(&nc_1 at c@, x, r); nc_sum at c@(&nc_1 at c@, x, pa); @@ -332,9 +397,6 @@ nc_log at c@(r, r); nc_prod at c@(&nc_half at c@, r, r); return; - /* - return nc_prod(nc_half,nc_log(nc_quot(nc_sum(nc_1,x),nc_diff(nc_1,x)))); - */ } static void @@ -435,1138 +497,973 @@ ***************************************************************************** */ +#define OUTPUT_LOOP\ + char *op = args[1];\ + intp os = steps[1];\ + intp n = dimensions[0];\ + intp i;\ + for(i = 0; i < n; i++, op += os) -/**begin repeat +#define UNARY_LOOP\ + char *ip1 = args[0], *op = args[1];\ + intp is1 = steps[0], os = steps[1];\ + intp n = dimensions[0];\ + intp i;\ + for(i = 0; i < n; i++, ip1 += is1, op += os) - #TYPE=(BOOL, BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE)*2# - #OP=||, +*13, ^, -*13# - #kind=add*14, subtract*14# - #typ=(Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*2# -*/ +#define UNARY_LOOP_TWO_OUT\ + char *ip1 = args[0], *op1 = args[1], *op2 = args[2];\ + intp is1 = steps[0], os1 = steps[1], os2 = steps[2];\ + intp n = dimensions[0];\ + intp i;\ + for(i = 0; i < n; i++, ip1 += is1, op1 += os1, op2 += os2) -static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) -{ - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i, >=, <, <=, &&, ||# + **/ + static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i, <# + **/ static void - at TYP@_multiply(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0], is2=steps[1], os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for (i=0; ireal, \ - ai=((c at typ@ *)i1)->imag, \ - br=((c at typ@ *)i2)->real, \ - bi=((c at typ@ *)i2)->imag; - ((c at typ@ *)op)->real = ar*br - ai*bi; - ((c at typ@ *)op)->imag = ar*bi + ai*br; + UNARY_LOOP { + Bool in1 = *(Bool *)ip1; + *((Bool *)op) = in1 @OP@ 0; } } +/**end repeat**/ static void - at TYP@_divide(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ones_like(char **args, intp *dimensions, intp *steps, void *data) { - register intp i; - intp is1=steps[0], is2=steps[1], os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for (i=0; ireal, \ - ai=((c at typ@ *)i1)->imag, \ - br=((c at typ@ *)i2)->real, \ - bi=((c at typ@ *)i2)->imag; - register @typ@ d = br*br + bi*bi; - ((c at typ@ *)op)->real = (ar*br + ai*bi)/d; - ((c at typ@ *)op)->imag = (ai*br - ar*bi)/d; + OUTPUT_LOOP { + *((Bool *)op) = 1; } } + +/* + ***************************************************************************** + ** INTEGER LOOPS + ***************************************************************************** + */ + +/**begin repeat + * #type = byte, short, int, long, longlong# + * #TYPE = BYTE, SHORT, INT, LONG, LONGLONG# + * #ftype = float, float, double, double, double# + */ + +/**begin repeat1 + * both signed and unsigned integer types + * #s = , u# + * #S = , U# + */ + +#define @S@@TYPE at _floor_divide @S@@TYPE at _divide + static void - at TYP@_floor_divide(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *data) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2],n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; ireal, \ - ai=((c at typ@ *)i1)->imag, \ - br=((c at typ@ *)i2)->real, \ - bi=((c at typ@ *)i2)->imag; - register @typ@ d = br*br + bi*bi; - ((c at typ@ *)op)->real = floor at c@((ar*br + ai*bi)/d); - ((c at typ@ *)op)->imag = 0; + OUTPUT_LOOP { + *((@s@@type@ *)op) = 1; } } -#define @TYP at _true_divide @TYP at _divide -/**end repeat**/ - - -/**begin repeat - #TYP=UBYTE,USHORT,UINT,ULONG,ULONGLONG# - #typ=ubyte, ushort, uint, ulong, ulonglong# -*/ static void - at TYP@_divide(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _square(char **args, intp *dimensions, intp *steps, void *data) { - register intp i, is1=steps[0],is2=steps[1],os=steps[2],n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i 0) != (y > 0)) && (x % y != 0)) tmp--; - *((@typ@ *)op)= tmp; - } + UNARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + *((@s@@type@ *)op) = 1.0/in1; } } -/**end repeat**/ - -/**begin repeat - #TYP=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG# - #typ=char, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong# - #otyp=float*4, double*6# -*/ static void - at TYP@_true_divide(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _conjugate(char **args, intp *dimensions, intp *steps, void *func) { - register intp i, is1=steps[0],is2=steps[1],os=steps[2],n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i># + */ static void - at TYP@_square(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - intp i, is1 = steps[0], os = steps[1], n = dimensions[0]; - char *i1 = args[0], *op = args[1]; - c at typ@ *x, *y; - @typ@ xr, xi; - - for (i = 0; i < n; i++, i1 += is1, op += os) { - x = (c at typ@ *)i1; - y = (c at typ@ *)op; - xr = x->real; - xi = x->imag; - y->real = xr*xr - xi*xi; - y->imag = 2*xr*xi; + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + *((@s@@type@ *)op) = in1 @OP@ in2; } } -/**end repeat**/ +/**end repeat2**/ -static PyObject * -Py_square(PyObject *o) +/**begin repeat2 + * #kind = equal, not_equal, greater, greater_equal, less, less_equal, + * logical_and, logical_or# + * #OP = ==, !=, >, >=, <, <=, &&, ||# + */ +static void + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - return PyNumber_Multiply(o, o); + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + *((Bool *)op) = in1 @OP@ in2; + } } +/**end repeat2**/ - -/**begin repeat - #TYP=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE# - #typ=char, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble# -*/ static void - at TYP@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _logical_xor(char **args, intp *dimensions, intp *steps, void *func) { - intp i, is1 = steps[0], os = steps[1], n = dimensions[0]; - char *i1 = args[0], *op = args[1]; - - for (i = 0; i < n; i++, i1 += is1, op += os) { - @typ@ x = *((@typ@ *)i1); - *((@typ@ *)op) = (@typ@) (1.0 / x); + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + *((Bool *)op)= (in1 && !in2) || (!in1 && in2); } } -/**end repeat**/ -/**begin repeat - #TYP=CFLOAT,CDOUBLE,CLONGDOUBLE# - #typ=float, double, longdouble# -*/ +/**begin repeat2 + * #kind = maximum, minimum# + * #OP = >, <# + **/ static void - at TYP@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - intp i, is1 = steps[0], os = steps[1], n = dimensions[0]; - char *i1 = args[0], *op = args[1]; - c at typ@ *x, *y; - @typ@ xr, xi, r, denom; - - for (i = 0; i < n; i++, i1 += is1, op += os) { - x = (c at typ@ *)i1; - y = (c at typ@ *)op; - xr = x->real; - xi = x->imag; - if (fabs(xi) <= fabs(xr)) { - r = xi / xr; - denom = xr + xi * r; - y->real = 1 / denom; - y->imag = -r / denom; - } else { - r = xr / xi; - denom = xr * r + xi; - y->real = r / denom; - y->imag = -1 / denom; - } + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + *((@s@@type@ *)op) = (in1 @OP@ in2) ? in1 : in2; } } -/**end repeat**/ +/**end repeat2**/ - -static PyObject * -Py_reciprocal(PyObject *o) +static void + at S@@TYPE at _true_divide(char **args, intp *dimensions, intp *steps, void *func) { - PyObject *one, *result; - one = PyInt_FromLong(1); - if (!one) return NULL; - result = PyNumber_Divide(one, o); - Py_DECREF(one); - return result; + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + if (in2 == 0) { + generate_divbyzero_error(); + *((@ftype@ *)op) = 0; + } + else { + *((@ftype@ *)op) = (@ftype@)in1 / (@ftype@)in2; + } + } } -static PyObject * -_npy_ObjectMax(PyObject *i1, PyObject *i2) +static void + at S@@TYPE at _power(char **args, intp *dimensions, intp *steps, void *func) { - int cmp; - PyObject *res; - if (PyObject_Cmp(i1, i2, &cmp) < 0) return NULL; - - if (cmp >= 0) { - res = i1; + BINARY_LOOP { + const @ftype@ in1 = (@ftype@)*(@s@@type@ *)ip1; + const @ftype@ in2 = (@ftype@)*(@s@@type@ *)ip2; + *((@s@@type@ *)op) = (@s@@type@) pow(in1, in2); } - else { - res = i2; - } - Py_INCREF(res); - return res; } -static PyObject * -_npy_ObjectMin(PyObject *i1, PyObject *i2) +static void + at S@@TYPE at _fmod(char **args, intp *dimensions, intp *steps, void *func) { - int cmp; - PyObject *res; - if (PyObject_Cmp(i1, i2, &cmp) < 0) return NULL; + BINARY_LOOP { + const @s@@type@ in1 = *(@s@@type@ *)ip1; + const @s@@type@ in2 = *(@s@@type@ *)ip2; + if (in2 == 0) { + generate_divbyzero_error(); + *((@s@@type@ *)op) = 0; + } + else { + *((@s@@type@ *)op)= in1 % in2; + } - if (cmp <= 0) { - res = i1; } - else { - res = i2; - } - Py_INCREF(res); - return res; } -/* ones_like is defined here because it's used for x**0 */ +/**end repeat1**/ -/**begin repeat - #TYP=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE# - #typ=char, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble# -*/ static void - at TYP@_ones_like(char **args, intp *dimensions, intp *steps, void *data) +U at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) { - intp i, os = steps[1], n = dimensions[0]; - char *op = args[1]; - - for (i = 0; i < n; i++, op += os) { - *((@typ@ *)op) = 1; + UNARY_LOOP { + const u at type@ in1 = *(u at type@ *)ip1; + *((u at type@ *)op) = in1; } } -/**end repeat**/ -/**begin repeat - #TYP=CFLOAT,CDOUBLE,CLONGDOUBLE# - #typ=float, double, longdouble# -*/ static void - at TYP@_ones_like(char **args, intp *dimensions, intp *steps, void *data) + at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) { - intp i, is1 = steps[0], os = steps[1], n = dimensions[0]; - char *i1 = args[0], *op = args[1]; - c at typ@ *y; - - for (i = 0; i < n; i++, i1 += is1, op += os) { - y = (c at typ@ *)op; - y->real = 1.0; - y->imag = 0.0; + UNARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + *((@type@ *)op) = (in1 >= 0) ? in1 : -in1; } } -/**end repeat**/ -static PyObject * -Py_get_one(PyObject *o) +static void +U at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) { - return PyInt_FromLong(1); + UNARY_LOOP { + const u at type@ in1 = *(u at type@ *)ip1; + *((u at type@ *)op) = in1 > 0 ? 1 : 0; + } } - -/**begin repeat - #TYP=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG# - #typ=char, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong# - #btyp=float*4, double*6# -*/ static void - at TYP@_power(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) { - register intp i, is1=steps[0],is2=steps[1]; - register intp os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - @btyp@ x, y; + UNARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + *((@type@ *)op) = in1 > 0 ? 1 : (in1 < 0 ? -1 : 0); + } +} - for(i=0; i 0) != (in2 > 0)) && (in1 % in2 != 0)) { + *((@type@ *)op) = in1/in2 - 1; + } + else { + *((@type@ *)op) = in1/in2; + } } } -/**end repeat**/ -/**begin repeat - #TYP=UBYTE, BYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE# - #typ=ubyte, char, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble# -*/ static void - at TYP@_conjugate(char **args, intp *dimensions, intp *steps, void *func) +U at TYPE@_divide(char **args, intp *dimensions, intp *steps, void *func) { - register intp i, is1=steps[0], os=steps[1], n=dimensions[0]; - char *i1=args[0], *op=args[1]; - for(i=0; i 0) == (in2 > 0) || rem == 0) { + *((@type@ *)op) = rem; + } + else { + *((@type@ *)op) = rem + in2; + } + } + } +} - for(i=0; i, >=, &&, ||# + */ static void - at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i, n; - intp is1=steps[0], os=steps[1]; - char *i1=args[0], *op=args[1]; - - n=dimensions[0]; - for(i=0; i, >=, <, <=, ==, !=, &&, ||, &, |, ^# -**/ static void -BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_logical_not(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - Bool in1, in2; - for(i=0; i*13, >=*13, <*13, <=*13# - #typ=(byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*4# - #kind= greater*13, greater_equal*13, less*13, less_equal*13# -*/ - +/**begin repeat1 + * #kind = isnan, isinf, isfinite, signbit# + * #func = isnan, isinf, isfinite, signbit# + **/ static void @TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i*3, >=*3, <*3, <=*3# - #typ=(cfloat, cdouble, clongdouble)*4# - #kind= greater*3, greater_equal*3, less*3, less_equal*3# -*/ - +/**begin repeat1 + * #kind = maximum, minimum# + * #OP = >, <# + **/ static void @TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; ireal == ((@typ@ *)i2)->real) - *((Bool *)op)=((@typ@ *)i1)->imag @OP@ \ - ((@typ@ *)i2)->imag; - else - *((Bool *)op)=((@typ@ *)i1)->real @OP@ \ - ((@typ@ *)i2)->real; + /* */ + BINARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + const @type@ in2 = *(@type@ *)ip2; + *((@type@ *)op) = in1 @OP@ in2 ? in1 : in2; } } -/**end repeat**/ +/**end repeat1**/ +static void + at TYPE@_floor_divide(char **args, intp *dimensions, intp *steps, void *func) +{ + BINARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + const @type@ in2 = *(@type@ *)ip2; + *((@type@ *)op) = floor at c@(in1/in2); + } +} -/**begin repeat - #TYPE=(BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE)*4# - #typ=(byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*4# - #OP= ==*13, !=*13, &&*13, ||*13# - #kind=equal*13, not_equal*13, logical_and*13, logical_or*13# -*/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i 0) ? in1 : -in1; + /* add 0 to clear -0.0 */ + *((@type@ *)op) = tmp + 0; } } -/**end repeat**/ -#define BOOL_negative BOOL_logical_not - -#define _SIGN1(x) ((x) > 0 ? 1 : ((x) < 0 ? -1 : 0)) -#define _SIGN2(x) ((x) == 0 ? 0 : 1) -#define _SIGNC(x) (((x).real > 0) ? 1 : ((x).real < 0 ? -1 : ((x).imag > 0 ? 1 : ((x).imag < 0) ? -1 : 0))) -/**begin repeat - #TYPE=BYTE,SHORT,INT,LONG,LONGLONG,FLOAT,DOUBLE,LONGDOUBLE,UBYTE,USHORT,UINT,ULONG,ULONGLONG# - #typ=byte,short,int,long,longlong,float,double,longdouble,ubyte,ushort,uint,ulong,ulonglong# - #func=_SIGN1*8,_SIGN2*5# -*/ static void - at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_negative(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],os=steps[1], n=dimensions[0]; - char *i1=args[0], *op=args[1]; - @typ@ t1; - for(i=0; i 0) { + *((@type@ *)op) = 1; + } + else if (in1 < 0) { + *((@type@ *)op) = -1; + } + else { + *((@type@ *)op) = 0; + } } } -/**end repeat**/ -#undef _SIGN1 -#undef _SIGN2 -#undef _SIGNC - - static void -OBJECT_sign(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_modf(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],os=steps[1], n=dimensions[0]; - char *i1=args[0], *op=args[1]; - PyObject *t1, *zero, *res; - zero = PyInt_FromLong(0); - for(i=0; ireal || \ - ((@typ@ *)i1)->imag); + BINARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + const int in2 = *(int *)ip2; + *(@type@ *)op = ldexp at c@(in1, in2); } } -/**end repeat**/ +#endif +#define @TYPE at _true_divide @TYPE at _divide +/**end repeat**/ +/* + ***************************************************************************** + ** COMPLEX LOOPS ** + ***************************************************************************** + */ + /**begin repeat - #TYPE=BYTE,SHORT,INT,LONG,LONGLONG# - #typ=byte, short, int, long, longlong# - #c=f*2,,,l*1# -*/ + * complex types + * #ctype= cfloat, cdouble, clongdouble# + * #CTYPE= CFLOAT, CDOUBLE, CLONGDOUBLE# + * #type = float, double, longdouble# + * #c = f, , l# + */ + +/**begin repeat1 + * arithmetic + * #kind = add, subtract# + * #OP = +, -# + */ static void - at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - register @typ@ ix,iy, tmp; - for(i=0; i 0) == (iy > 0)) { - *((@typ@ *)op) = ix % iy; - } - else { /* handle mixed case the way Python does */ - tmp = ix % iy; - if (tmp) tmp += iy; - *((@typ@ *)op)= tmp; - } + BINARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + const @type@ in2r = ((@type@ *)ip2)[0]; + const @type@ in2i = ((@type@ *)ip2)[1]; + ((@type@ *)op)[0] = in1r @OP@ in2r; + ((@type@ *)op)[1] = in1i @OP@ in2i; } } -/**end repeat**/ +/**end repeat1**/ -/**begin repeat - #TYPE=UBYTE,USHORT,UINT,ULONG,ULONGLONG# - #typ=ubyte, ushort, uint, ulong, ulonglong# -*/ static void - at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_multiply(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - register @typ@ ix,iy; - for(i=0; i, >=, <, <=# + */ +static void + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +{ + BINARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + const @type@ in2r = ((@type@ *)ip2)[0]; + const @type@ in2i = ((@type@ *)ip2)[1]; + if (in1r != in2r) { + *((Bool *)op) = in1r @OP@ in2r ? 1 : 0; } else { - *((@typ@ *)op)= x % y; + *((Bool *)op) = in1i @OP@ in2i ? 1 : 0; } - } } -/**end repeat**/ +/**end repeat1**/ -/**begin repeat - - #TYPE=(BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG)*5# - #typ=(byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong)*5# - #OP= &*10, |*10, ^*10, <<*10, >>*10# - #kind=bitwise_and*10, bitwise_or*10, bitwise_xor*10, left_shift*10, right_shift*10# - +/**begin repeat1 + #kind = logical_and, logical_or# + #OP1 = ||, ||# + #OP2 = &&, ||# */ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - register char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; ireal || ((@typ@ *)i1)->imag; - p2 = ((@typ@ *)i2)->real || ((@typ@ *)i2)->imag; - *((Bool *)op)= (p1 || p2) && !(p1 && p2); + UNARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + ((@type@ *)op)[0] = in1r*in1r - in1i*in1i; + ((@type@ *)op)[1] = in1r*in1i + in1i*in1r; } } -/**end repeat**/ - - -/**begin repeat - - #TYPE=(BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE)*2# - #OP= >*14, <*14# - #typ=(Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble)*2# - #kind= maximum*14, minimum*14# -*/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - for(i=0; i*3, <*3# - #typ=(cfloat, cdouble, clongdouble)*2# - #kind= maximum*3, minimum*3# -*/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ones_like(char **args, intp *dimensions, intp *steps, void *data) { - register intp i; - intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0]; - char *i1=args[0], *i2=args[1], *op=args[2]; - @typ@ *i1c, *i2c; - for(i=0; ireal @OP@ i2c->real) || \ - ((i1c->real==i2c->real) && (i1c->imag @OP@ i2c->imag))) - memmove(op, i1, sizeof(@typ@)); - else - memmove(op, i2, sizeof(@typ@)); + OUTPUT_LOOP { + ((@type@ *)op)[0] = 1; + ((@type@ *)op)[1] = 0; } } -/**end repeat**/ +static void + at CTYPE@_conjugate(char **args, intp *dimensions, intp *steps, void *func) { + UNARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + ((@type@ *)op)[0] = in1r; + ((@type@ *)op)[1] = -in1i; + } +} - -/*** isinf, isinf, isfinite, signbit ***/ -/**begin repeat - #kind=isnan*3, isinf*3, isfinite*3, signbit*3# - #TYPE=(FLOAT, DOUBLE, LONGDOUBLE)*4# - #typ=(float, double, longdouble)*4# -*/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is=steps[0], os=steps[1], n=dimensions[0]; - char *ip=args[0], *op=args[1]; - for(i=0; i 0) { + ((@type@ *)op)[0] = 1; + } + else if (in1r < 0) { + ((@type@ *)op)[0] = -1; + } + else { + if (in1i > 0) { + ((@type@ *)op)[0] = 1; + } + else if (in1i < 0) { + ((@type@ *)op)[0] = -1; + } + else { + ((@type@ *)op)[0] = 0; + } + } + ((@type@ *)op)[1] = 0; } } -/**end repeat**/ - - - -/****** modf ****/ - -/**begin repeat - #TYPE=FLOAT, DOUBLE, LONGDOUBLE# - #typ=float, double, longdouble# - #c=f,,l# -*/ +/**begin repeat1 + * #kind = maximum, minimum# + * #OP = >, <# + */ static void - at TYPE@_modf(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { - register intp i; - intp is1=steps[0],os1=steps[1],os2=steps[2],n=dimensions[0]; - char *i1=args[0], *op1=args[1], *op2=args[2]; - @typ@ x1, y1, y2; - for (i=0; i Author: cdavid Date: 2008-10-05 03:28:42 -0500 (Sun, 05 Oct 2008) New Revision: 5913 Added: trunk/numpy/core/src/math_c99.inc.src Removed: trunk/numpy/core/src/_isnan.c Modified: trunk/ trunk/numpy/core/SConscript trunk/numpy/core/include/numpy/ufuncobject.h trunk/numpy/core/setup.py trunk/numpy/core/src/_signbit.c trunk/numpy/core/src/umathmodule.c.src trunk/numpy/distutils/command/config.py Log: Merged revisions 5737-5912 via svnmerge from http://svn.scipy.org/svn/numpy/branches/clean_math_config ................ r5738 | cdavid | 2008-09-01 21:18:52 +0900 (Mon, 01 Sep 2008) | 3 lines Initialized merge tracking via "svnmerge" with revisions "1-5737" from http://svn.scipy.org/svn/numpy/trunk ................ r5756 | cdavid | 2008-09-04 22:49:42 +0900 (Thu, 04 Sep 2008) | 1 line Add a math_c99 compatibility module. ................ r5757 | cdavid | 2008-09-04 22:58:47 +0900 (Thu, 04 Sep 2008) | 1 line Add float and long double functions (C99). ................ r5758 | cdavid | 2008-09-04 23:35:51 +0900 (Thu, 04 Sep 2008) | 1 line Use code generator for c99_math.c ................ r5759 | cdavid | 2008-09-04 23:37:29 +0900 (Thu, 04 Sep 2008) | 1 line move C99 math stuff to a .src file. ................ r5760 | cdavid | 2008-09-04 23:40:00 +0900 (Thu, 04 Sep 2008) | 1 line Add expm1 function in c99 compat module. ................ r5761 | cdavid | 2008-09-04 23:45:33 +0900 (Thu, 04 Sep 2008) | 4 lines Use C99 math compatibility module. Completely broken for now, needs to update the configuration stage. ................ r5762 | cdavid | 2008-09-04 23:55:01 +0900 (Thu, 04 Sep 2008) | 66 lines Merged revisions 5738-5761 via svnmerge from http://svn.scipy.org/svn/numpy/trunk ........ r5739 | cdavid | 2008-09-01 21:50:46 +0900 (Mon, 01 Sep 2008) | 1 line Disable memmap test which crashes nose tests on cygwin. ........ r5740 | cdavid | 2008-09-01 22:07:30 +0900 (Mon, 01 Sep 2008) | 2 lines Fix unused variable warning in object_arrtype_new. ........ r5741 | cdavid | 2008-09-02 15:59:43 +0900 (Tue, 02 Sep 2008) | 5 lines Fix regression test #771 on 64 bits architecture. The test assumed an item was 4 bytes. Use itemsize instead of harcoding 4 bytes per item. ........ r5742 | jarrod.millman | 2008-09-03 05:13:17 +0900 (Wed, 03 Sep 2008) | 2 lines pulling out testing docs from distutils docs ........ r5743 | jarrod.millman | 2008-09-03 05:32:38 +0900 (Wed, 03 Sep 2008) | 2 lines reindenting prior to release ........ r5745 | jarrod.millman | 2008-09-03 08:52:37 +0900 (Wed, 03 Sep 2008) | 2 lines trunk is open for 1.3 development ........ r5748 | alan.mcintyre | 2008-09-03 14:10:39 +0900 (Wed, 03 Sep 2008) | 3 lines Fix __init__.py boilerplate example in DISTUTILS.txt, and moved content from SciPy wiki entry on testing guidelines to TESTS.txt. ........ r5749 | alan.mcintyre | 2008-09-03 15:11:28 +0900 (Wed, 03 Sep 2008) | 3 lines Updated TESTS.txt to actually be ReST. Capitalization nitpickery in DISTUTILS.txt: 'Scipy' -> 'SciPy' ........ r5750 | alan.mcintyre | 2008-09-03 16:49:59 +0900 (Wed, 03 Sep 2008) | 2 lines Added section discussing using subclassing to create similar tests. ........ r5751 | pierregm | 2008-09-04 01:48:52 +0900 (Thu, 04 Sep 2008) | 1 line docstring update ........ r5752 | cdavid | 2008-09-04 01:54:37 +0900 (Thu, 04 Sep 2008) | 1 line Start a nep for warn-free numpy build. ........ r5753 | cdavid | 2008-09-04 22:31:24 +0900 (Thu, 04 Sep 2008) | 1 line Update the warnfix nep. ........ r5754 | cdavid | 2008-09-04 22:36:53 +0900 (Thu, 04 Sep 2008) | 1 line Start a nep for cleaning the math configuration. ........ r5755 | cdavid | 2008-09-04 22:49:01 +0900 (Thu, 04 Sep 2008) | 1 line Update clean math config nep. ........ ................ r5763 | cdavid | 2008-09-05 00:12:45 +0900 (Fri, 05 Sep 2008) | 1 line put the setup code to check for match cap in a separate function. ................ r5764 | cdavid | 2008-09-05 00:31:57 +0900 (Fri, 05 Sep 2008) | 1 line Check for non-mandatory, basic, double functions. ................ r5765 | cdavid | 2008-09-05 00:32:29 +0900 (Fri, 05 Sep 2008) | 1 line Do not build math_c99.c, only set it as a dependency. ................ r5766 | cdavid | 2008-09-05 00:39:38 +0900 (Fri, 05 Sep 2008) | 5 lines Manually generate math_c99.c I did not find a way to generate math_c99.c from math_c99.src with distutils, so let's include the generated file for now. ................ r5767 | cdavid | 2008-09-05 01:29:09 +0900 (Fri, 05 Sep 2008) | 1 line Keep the cruft for compatibility for now. ................ r5773 | cdavid | 2008-09-05 12:12:37 +0900 (Fri, 05 Sep 2008) | 1 line Check for all float/long double C99 math funcs explicitely. ................ r5774 | cdavid | 2008-09-05 12:15:25 +0900 (Fri, 05 Sep 2008) | 1 line Use calling version of check func. ................ r5775 | cdavid | 2008-09-05 12:19:04 +0900 (Fri, 05 Sep 2008) | 1 line Use the way formely used by setup to set backward-compatible defines. ................ r5776 | cdavid | 2008-09-05 14:37:06 +0900 (Fri, 05 Sep 2008) | 1 line Tell vim to recognize umathmodule.c.src as a C file. ................ r5777 | cdavid | 2008-09-05 14:44:39 +0900 (Fri, 05 Sep 2008) | 1 line Add fmod and modf as mandatory functions. ................ r5778 | cdavid | 2008-09-05 14:49:32 +0900 (Fri, 05 Sep 2008) | 1 line Add frexp and ldexp as the functions to lookf for C99 versions. ................ r5779 | cdavid | 2008-09-05 15:11:26 +0900 (Fri, 05 Sep 2008) | 1 line Add a check_funcs_once function to speed up func checks. ................ r5780 | cdavid | 2008-09-05 15:21:18 +0900 (Fri, 05 Sep 2008) | 1 line Use check_funcs_once to speed-up configuration on sane platforms. ................ r5781 | cdavid | 2008-09-05 15:25:57 +0900 (Fri, 05 Sep 2008) | 1 line Speed up the math configuration using check_funcs_once. ................ r5782 | cdavid | 2008-09-05 15:34:55 +0900 (Fri, 05 Sep 2008) | 1 line Fix indentation. ................ r5783 | cdavid | 2008-09-05 15:47:10 +0900 (Fri, 05 Sep 2008) | 1 line Remove HAVE_FLOAT_FUNCS, and use function-specific HAVE_ instead. ................ r5784 | cdavid | 2008-09-05 15:47:40 +0900 (Fri, 05 Sep 2008) | 1 line Remove HAVE_INVERSE_* for inverse hyperbolic funcs: not needed anymore. ................ r5785 | cdavid | 2008-09-05 15:49:48 +0900 (Fri, 05 Sep 2008) | 1 line Check for isnan and isinf. ................ r5786 | cdavid | 2008-09-05 15:59:44 +0900 (Fri, 05 Sep 2008) | 1 line Do not check for the same functions twice. ................ r5787 | cdavid | 2008-09-05 16:00:12 +0900 (Fri, 05 Sep 2008) | 1 line ldexp is a mandatory function. ................ r5812 | cdavid | 2008-09-13 16:04:41 +0900 (Sat, 13 Sep 2008) | 105 lines Merged revisions 5762-5811 via svnmerge from http://svn.scipy.org/svn/numpy/trunk ........ r5768 | ptvirtan | 2008-09-05 03:04:35 +0900 (Fri, 05 Sep 2008) | 1 line Ufunc docstrings: show the 'out' arguments in a more standard way ........ r5769 | alan.mcintyre | 2008-09-05 03:23:48 +0900 (Fri, 05 Sep 2008) | 4 lines Replaced numpy.testing.decorators.skipknownfailure with knownfailureif, which allows flagging tests as known failures rather than skips. Updated test_umath to use knownfailureif. ........ r5770 | alan.mcintyre | 2008-09-05 06:13:29 +0900 (Fri, 05 Sep 2008) | 2 lines Renamed classes to conform to PEP 8. ........ r5771 | alan.mcintyre | 2008-09-05 07:06:01 +0900 (Fri, 05 Sep 2008) | 2 lines Fix link to example.py. ........ r5772 | alan.mcintyre | 2008-09-05 10:20:09 +0900 (Fri, 05 Sep 2008) | 2 lines Remove debugging code. ........ r5788 | dhuard | 2008-09-05 22:58:00 +0900 (Fri, 05 Sep 2008) | 1 line Applied patch from R. May fixing ticket #905 (loadtxt). Fixed other bug occurring when both usecols and converters are provided. Added related regression tests. ........ r5789 | oliphant | 2008-09-05 23:06:02 +0900 (Fri, 05 Sep 2008) | 1 line Add final date-time proposal. ........ r5791 | pierregm | 2008-09-06 08:38:44 +0900 (Sat, 06 Sep 2008) | 1 line * fixed deepcopy of masked arrays (bug #906) ........ r5793 | cdavid | 2008-09-07 16:16:28 +0900 (Sun, 07 Sep 2008) | 8 lines scons command: fix one more issue related to build dir. The distutils installation directory relative to the scons build directory was not always computed right. The relative position on the fs does not depend on the source directory (in out-of-place builds), but on the package *name* translated to a directly only. ........ r5796 | pearu | 2008-09-09 19:55:30 +0900 (Tue, 09 Sep 2008) | 1 line Fix typo. ........ r5797 | stefan | 2008-09-09 22:38:34 +0900 (Tue, 09 Sep 2008) | 2 lines FIX: Loadtxt raises on empty input (closes #908). ........ r5799 | alan.mcintyre | 2008-09-10 02:48:47 +0900 (Wed, 10 Sep 2008) | 2 lines Removed unused imports. ........ r5800 | pierregm | 2008-09-10 03:25:15 +0900 (Wed, 10 Sep 2008) | 1 line * make sure that minimum & maximum actually return a MaskedArray ........ r5803 | pierregm | 2008-09-12 04:54:31 +0900 (Fri, 12 Sep 2008) | 1 line * fixed view for MaskedArrays w/ flexible dtype ........ r5804 | jarrod.millman | 2008-09-13 04:20:26 +0900 (Sat, 13 Sep 2008) | 2 lines FIX: broken links ........ r5805 | jarrod.millman | 2008-09-13 04:23:20 +0900 (Sat, 13 Sep 2008) | 2 lines FIX: broken links ........ r5806 | alan.mcintyre | 2008-09-13 11:53:53 +0900 (Sat, 13 Sep 2008) | 2 lines Fix failing doctests. ........ r5807 | alan.mcintyre | 2008-09-13 11:56:33 +0900 (Sat, 13 Sep 2008) | 2 lines Remove unused imports. ........ r5808 | alan.mcintyre | 2008-09-13 12:40:57 +0900 (Sat, 13 Sep 2008) | 7 lines Removed unused/duplicate imports. Removed repeated members of __all__. Fixed reference to undefined "out" in functions.py:take function. Fixed references to undefined "N" in functions.py. Rewrapped lines to conform to PEP8. Fixed references to undefined FPE_* constants (from numpy) in util.py. ........ r5809 | cdavid | 2008-09-13 15:03:30 +0900 (Sat, 13 Sep 2008) | 6 lines Fix cygwin compilation Recent version of binutils (2.18.50) do not accept 4 bytes operand for some opcodes like fnstsw (which always expected a 2 bytes operand). Replace the type of the argument from unsigned 2 bytes to unsigned 4 bytes unsigned integer. ........ r5810 | cdavid | 2008-09-13 15:27:46 +0900 (Sat, 13 Sep 2008) | 1 line Tag ctypes load library tests as known failures on cygwin. ........ ................ r5813 | cdavid | 2008-09-13 16:16:32 +0900 (Sat, 13 Sep 2008) | 1 line Detect declaration of isnan and co only. ................ r5814 | cdavid | 2008-09-13 16:25:51 +0900 (Sat, 13 Sep 2008) | 1 line Clean IEEE handling: define them as macro. ................ r5815 | cdavid | 2008-09-13 16:27:25 +0900 (Sat, 13 Sep 2008) | 1 line Update generated math_c99 compat module. ................ r5816 | cdavid | 2008-09-13 16:28:08 +0900 (Sat, 13 Sep 2008) | 1 line Remove trailing spaces. ................ r5817 | cdavid | 2008-09-13 16:30:07 +0900 (Sat, 13 Sep 2008) | 1 line remove unused _isnan.c ................ r5818 | cdavid | 2008-09-13 16:48:29 +0900 (Sat, 13 Sep 2008) | 1 line Fix typo in setup.py ................ r5819 | cdavid | 2008-09-13 17:08:16 +0900 (Sat, 13 Sep 2008) | 1 line Do not depend on _isnan.c. ................ r5820 | cdavid | 2008-09-13 17:09:02 +0900 (Sat, 13 Sep 2008) | 1 line Rename signbit replacement to signbit_d to avoid clash between macro and function. ................ r5836 | cdavid | 2008-09-20 17:22:25 +0900 (Sat, 20 Sep 2008) | 1 line Include Python.h before math.h for declaration tests in mathlib. ................ r5837 | cdavid | 2008-09-20 17:47:19 +0900 (Sat, 20 Sep 2008) | 1 line Remove the generated math_c99.c file from svn; generate it automatically from setup.py. ................ r5838 | cdavid | 2008-09-20 18:48:01 +0900 (Sat, 20 Sep 2008) | 1 line Test for MSVC, because we will need to special case for this F***** compiler once again. ................ r5839 | cdavid | 2008-09-20 19:05:52 +0900 (Sat, 20 Sep 2008) | 1 line Assume mandatory funcs available with MSVC. ................ r5840 | cdavid | 2008-09-20 19:18:59 +0900 (Sat, 20 Sep 2008) | 1 line Fix typo in CPP define. ................ r5841 | cdavid | 2008-09-20 19:49:01 +0900 (Sat, 20 Sep 2008) | 1 line Undef macro when using replacement functions in math_c99 module. ................ r5842 | cdavid | 2008-09-20 19:51:35 +0900 (Sat, 20 Sep 2008) | 1 line Forgot to define M_PI if not available. ................ r5843 | cdavid | 2008-09-20 19:53:27 +0900 (Sat, 20 Sep 2008) | 1 line Forgot to define float/long double version of log1p if not available on the platform. ................ r5844 | cdavid | 2008-09-20 20:39:20 +0900 (Sat, 20 Sep 2008) | 78 lines Merged revisions 5812-5843 via svnmerge from http://svn.scipy.org/svn/numpy/trunk ........ r5821 | alan.mcintyre | 2008-09-14 03:04:57 +0900 (Sun, 14 Sep 2008) | 3 lines Removed unused imports. Standardize NumPy import as "import numpy as np". ........ r5822 | alan.mcintyre | 2008-09-14 03:10:48 +0900 (Sun, 14 Sep 2008) | 6 lines Rewrapped __all__ definition to conform to PEP8. Standardize NumPy import as "import numpy as np". Removed unused imports. Fixed undefined reference to ndarray (should be np.ndarray). Fixed undefined references to exp (should be math.exp). ........ r5823 | alan.mcintyre | 2008-09-14 03:15:38 +0900 (Sun, 14 Sep 2008) | 3 lines Removed unused imports. Fixed undefined reference to "getpackage" (from nose.util). ........ r5824 | pierregm | 2008-09-14 06:17:09 +0900 (Sun, 14 Sep 2008) | 1 line MaskedArray.__new__ : make sure that we inherit the _hardmask from data (if any) instead of reverting to default. ........ r5826 | alan.mcintyre | 2008-09-18 12:29:56 +0900 (Thu, 18 Sep 2008) | 4 lines Added documentation for doctests and using the skipif and knownfailureif decorators. Fixed indentation on the last sample snippet in the "__init__.py and setup.py" section. ........ r5827 | alan.mcintyre | 2008-09-18 12:33:15 +0900 (Thu, 18 Sep 2008) | 3 lines Rewrapped __all__ to conform with PEP8. Removed unused imports. ........ r5828 | alan.mcintyre | 2008-09-18 12:33:58 +0900 (Thu, 18 Sep 2008) | 2 lines Removed unused imports. ........ r5829 | alan.mcintyre | 2008-09-18 12:45:53 +0900 (Thu, 18 Sep 2008) | 3 lines Removed unused/redundant imports. PEP8 conformance (only one import per line). ........ r5830 | alan.mcintyre | 2008-09-18 12:57:47 +0900 (Thu, 18 Sep 2008) | 2 lines Removed redundant import. ........ r5831 | pierregm | 2008-09-19 02:51:55 +0900 (Fri, 19 Sep 2008) | 1 line median : fixed a bug in _median1D (there shouldn't have been an axis) ........ r5832 | jarrod.millman | 2008-09-19 03:53:53 +0900 (Fri, 19 Sep 2008) | 2 lines ReSTified an URL ........ r5833 | rkern | 2008-09-19 06:48:57 +0900 (Fri, 19 Sep 2008) | 1 line BUG: Override setuptools' install.run() method to correctly allow 'python setup.py install' to work. ........ r5834 | pierregm | 2008-09-19 12:33:40 +0900 (Fri, 19 Sep 2008) | 1 line * fixing view to recognize dtype and type parameters, for consistency with regular ndarrays. ........ r5835 | pierregm | 2008-09-20 04:43:05 +0900 (Sat, 20 Sep 2008) | 8 lines core: * add dtype to the repr of masked arrays w/ flexible type * prevent __getitem__ to return masked on flexible-type masked array * make sure __str__ returns something sensible for flexible dtype w/ masked fields * simplify the count method mrecords: * fixed a pb with fromrecords when the number of fields cannot be determined from the first element. ........ ................ r5845 | cdavid | 2008-09-21 00:58:44 +0900 (Sun, 21 Sep 2008) | 1 line Remove redundant definition of isnan and co in ufuncobject.h ................ r5846 | cdavid | 2008-09-21 01:00:09 +0900 (Sun, 21 Sep 2008) | 1 line Use a single macro for isnan replacement. ................ r5847 | cdavid | 2008-09-21 01:01:22 +0900 (Sun, 21 Sep 2008) | 1 line Use a single macro for isinf replacement. ................ r5848 | cdavid | 2008-09-21 01:10:53 +0900 (Sun, 21 Sep 2008) | 1 line Move isfinite macro with isinf and isnan. ................ r5849 | cdavid | 2008-09-21 01:11:51 +0900 (Sun, 21 Sep 2008) | 1 line Fix isfinite. ................ r5850 | cdavid | 2008-09-21 01:12:59 +0900 (Sun, 21 Sep 2008) | 1 line Autoconf suggestion is totally bogus: isinf(nan) is false, not true. ................ r5851 | cdavid | 2008-09-21 01:13:48 +0900 (Sun, 21 Sep 2008) | 1 line Define isfinite first, and define isinf in function of isfinite/isnan. ................ r5852 | cdavid | 2008-09-21 01:26:30 +0900 (Sun, 21 Sep 2008) | 6 lines Fix for isfinite on VS 2003. VS 2003 seems to think it is ok to simplify x-x to 0 for float, but this is wrong for NaN and Inf. To alleviate, we force the operation to occur with (x) + (-x). ................ r5853 | cdavid | 2008-09-21 01:56:08 +0900 (Sun, 21 Sep 2008) | 1 line More intrinsics. ................ r5855 | cdavid | 2008-09-21 20:39:08 +0900 (Sun, 21 Sep 2008) | 1 line Handle msvc intrisincs in check_func. ................ r5856 | cdavid | 2008-09-21 20:39:27 +0900 (Sun, 21 Sep 2008) | 1 line Handle msvc intrisincs in check_funcs_once. ................ r5857 | cdavid | 2008-09-21 20:50:32 +0900 (Sun, 21 Sep 2008) | 1 line define -> pragma, stupid mistake. ................ r5858 | cdavid | 2008-09-21 20:54:48 +0900 (Sun, 21 Sep 2008) | 1 line Do not use MSVC workaround anymore, since we now can test for function even when they are intrinsincs. ................ r5861 | cdavid | 2008-09-23 12:48:01 +0900 (Tue, 23 Sep 2008) | 9 lines Merged revisions 5844-5860 via svnmerge from http://svn.scipy.org/svn/numpy/trunk ........ r5860 | stefan | 2008-09-23 05:28:00 +0900 (Tue, 23 Sep 2008) | 2 lines Ignore unused converters in `loadtxt`. ........ ................ r5874 | charris | 2008-09-29 08:35:15 +0900 (Mon, 29 Sep 2008) | 4 lines Enhance code_generator to allow continuation lines. Small clarification in arraytypes.inc.src. Practice merging ;) ................ r5882 | cdavid | 2008-09-30 13:40:13 +0900 (Tue, 30 Sep 2008) | 27 lines Merged revisions 5861-5881 via svnmerge from http://svn.scipy.org/svn/numpy/trunk ........ r5862 | ptvirtan | 2008-09-24 20:50:38 +0900 (Wed, 24 Sep 2008) | 1 line Fix python2.5 dependency in lookfor ........ r5869 | pierregm | 2008-09-29 02:27:37 +0900 (Mon, 29 Sep 2008) | 3 lines core: * added __rmul and __radd__ * fixed concatenate for flexible-dtype ........ r5878 | ptvirtan | 2008-09-30 02:23:43 +0900 (Tue, 30 Sep 2008) | 1 line Umath tests: remove signed zero check on branch cut for log* as it fails on some platforms. ........ r5879 | pierregm | 2008-09-30 05:24:29 +0900 (Tue, 30 Sep 2008) | 1 line use if ...: raise AssertionError instead of assert ........ r5880 | pierregm | 2008-09-30 05:24:56 +0900 (Tue, 30 Sep 2008) | 1 line replaced assert with self.failUnless ........ ................ r5898 | cdavid | 2008-10-03 16:21:00 +0900 (Fri, 03 Oct 2008) | 1 line Start updating numscons configuration for new math config. ................ r5899 | cdavid | 2008-10-03 16:21:15 +0900 (Fri, 03 Oct 2008) | 1 line Add an help function to check a list of functions in scons build. ................ r5900 | cdavid | 2008-10-03 16:21:31 +0900 (Fri, 03 Oct 2008) | 1 line Fix typo in check_funcs. ................ r5901 | cdavid | 2008-10-03 16:21:46 +0900 (Fri, 03 Oct 2008) | 1 line Check for some optional, C99 double math functions. ................ r5902 | cdavid | 2008-10-03 16:22:02 +0900 (Fri, 03 Oct 2008) | 1 line Check for float/long double C99 functions. ................ r5903 | cdavid | 2008-10-03 16:22:18 +0900 (Fri, 03 Oct 2008) | 1 line Add check for C99 macros related IEEE-754. ................ r5904 | cdavid | 2008-10-03 16:22:34 +0900 (Fri, 03 Oct 2008) | 1 line Remove old configuration checks, supersded by new math config. ................ r5905 | cdavid | 2008-10-03 16:22:57 +0900 (Fri, 03 Oct 2008) | 1 line Generate math_c99.inc in numscons build. ................ r5912 | cdavid | 2008-10-05 16:00:33 +0900 (Sun, 05 Oct 2008) | 39 lines Merged revisions 5882-5911 via svnmerge from http://svn.scipy.org/svn/numpy/trunk ........ r5886 | charris | 2008-10-02 03:05:29 +0900 (Thu, 02 Oct 2008) | 4 lines Make some error messages more informative. Improve error handling. Make continuation lines work. ........ r5887 | charris | 2008-10-02 03:06:04 +0900 (Thu, 02 Oct 2008) | 2 lines Small cleanup to clarify repeated string. ........ r5888 | charris | 2008-10-02 03:08:41 +0900 (Thu, 02 Oct 2008) | 6 lines Cleanup ufunc loops. At this point loops are separated into variable kinds, so there is a fair amount of duplication. I will probably merge loops that look the same in a later commit. There are no changes to current behavior of loops, this will also be changed in later work to deal with nans and such. ........ r5889 | oliphant | 2008-10-03 05:27:17 +0900 (Fri, 03 Oct 2008) | 1 line Fix problem with subclasses of object arrays. ........ r5896 | cdavid | 2008-10-03 15:50:32 +0900 (Fri, 03 Oct 2008) | 1 line Update the minimum version for numscons: had to change to cope with Chuck changes to conv_template.py. ........ r5897 | cdavid | 2008-10-03 15:51:03 +0900 (Fri, 03 Oct 2008) | 1 line Update doall script: take the python version to build binaries from the command line instead of global variable. ........ r5906 | oliphant | 2008-10-04 00:55:52 +0900 (Sat, 04 Oct 2008) | 1 line Fix ticket #925 ........ ................ Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/aligned_alloca:1-5127 /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/clean_math_config:1-5736 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /cleaned_math_config:1-5731 /trunk:1-2871 + /branches/aligned_alloca:1-5127 /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/clean_math_config:1-5912 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /cleaned_math_config:1-5731 /trunk:1-2871 Modified: trunk/numpy/core/SConscript =================================================================== --- trunk/numpy/core/SConscript 2008-10-05 07:00:33 UTC (rev 5912) +++ trunk/numpy/core/SConscript 2008-10-05 08:28:42 UTC (rev 5913) @@ -1,4 +1,4 @@ -# Last Change: Tue Aug 05 12:00 PM 2008 J +# Last Change: Fri Oct 03 04:00 PM 2008 J # vim:syntax=python import os import sys @@ -136,39 +136,56 @@ # Set value to 1 for each defined function (in math lib) mfuncs_defined = dict([(f, 0) for f in mfuncs]) -# TODO: checklib vs checkfunc ? -def check_func(f): - """Check that f is available in mlib, and add the symbol appropriately. """ - st = config.CheckDeclaration(f, language = 'C', includes = "#include ") - if st: - st = config.CheckFunc(f, language = 'C') - if st: - mfuncs_defined[f] = 1 - else: - mfuncs_defined[f] = 0 +# Check for mandatory funcs: we barf if a single one of those is not there +mandatory_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", +"floor", "ceil", "sqrt", "log10", "log", "exp", "asin", "acos", "atan", "fmod", +'modf', 'frexp', 'ldexp'] -for f in mfuncs: - check_func(f) +if not config.CheckFuncsAtOnce(mandatory_funcs): + raise SystemError("One of the required function to build numpy is not" + " available (the list is %s)." % str(mandatory_funcs)) -if mfuncs_defined['expl'] == 1: - config.Define('HAVE_LONGDOUBLE_FUNCS', - comment = 'Define to 1 if long double funcs are available') -if mfuncs_defined['expf'] == 1: - config.Define('HAVE_FLOAT_FUNCS', - comment = 'Define to 1 if long double funcs are available') -if mfuncs_defined['asinh'] == 1: - config.Define('HAVE_INVERSE_HYPERBOLIC', - comment = 'Define to 1 if inverse hyperbolic funcs are '\ - 'available') -if mfuncs_defined['atanhf'] == 1: - config.Define('HAVE_INVERSE_HYPERBOLIC_FLOAT', - comment = 'Define to 1 if inverse hyperbolic float funcs '\ - 'are available') -if mfuncs_defined['atanhl'] == 1: - config.Define('HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE', - comment = 'Define to 1 if inverse hyperbolic long double '\ - 'funcs are available') +# Standard functions which may not be available and for which we have a +# replacement implementation +# +def check_funcs(funcs): + # Use check_funcs_once first, and if it does not work, test func per + # func. Return success only if all the functions are available + st = config.CheckFuncsAtOnce(funcs) + if not st: + # Global check failed, check func per func + for f in funcs: + st = config.CheckFunc(f, language = 'C') +# XXX: we do not test for hypot because python checks for it (HAVE_HYPOT in +# python.h... I wish they would clean their public headers someday) +optional_stdfuncs = ["expm1", "log1p", "acosh", "asinh", "atanh", + "rint", "trunc"] + +check_funcs(optional_stdfuncs) + +# C99 functions: float and long double versions +c99_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", "floor", + "ceil", "rint", "trunc", "sqrt", "log10", "log", "exp", + "expm1", "asin", "acos", "atan", "asinh", "acosh", "atanh", + "hypot", "atan2", "pow", "fmod", "modf", 'frexp', 'ldexp'] + +for prec in ['l', 'f']: + fns = [f + prec for f in c99_funcs] + check_funcs(fns) + +# Normally, isnan and isinf are macro (C99), but some platforms only have +# func, or both func and macro version. Check for macro only, and define +# replacement ones if not found. +# Note: including Python.h is necessary because it modifies some math.h +# definitions +for f in ["isnan", "isinf", "signbit", "isfinite"]: + includes = """\ +#include +#include +""" + config.CheckDeclaration(f, includes=includes) + #------------------------------------------------------- # Define the function PyOS_ascii_strod if not available #------------------------------------------------------- @@ -234,6 +251,7 @@ # Generate generated code #------------------------ scalartypes_src = env.GenerateFromTemplate(pjoin('src', 'scalartypes.inc.src')) +math_c99_src = env.GenerateFromTemplate(pjoin('src', 'math_c99.inc.src')) arraytypes_src = env.GenerateFromTemplate(pjoin('src', 'arraytypes.inc.src')) sortmodule_src = env.GenerateFromTemplate(pjoin('src', '_sortmodule.c.src')) umathmodule_src = env.GenerateFromTemplate(pjoin('src', 'umathmodule.c.src')) Modified: trunk/numpy/core/include/numpy/ufuncobject.h =================================================================== --- trunk/numpy/core/include/numpy/ufuncobject.h 2008-10-05 07:00:33 UTC (rev 5912) +++ trunk/numpy/core/include/numpy/ufuncobject.h 2008-10-05 08:28:42 UTC (rev 5913) @@ -263,11 +263,6 @@ | ((SW_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \ } -#define isnan(x) (_isnan((double)(x))) -#define isinf(x) ((_fpclass((double)(x)) == _FPCLASS_PINF) || \ - (_fpclass((double)(x)) == _FPCLASS_NINF)) -#define isfinite(x) (_finite((double) x)) - /* Solaris --------------------------------------------------------*/ /* --------ignoring SunOS ieee_flags approach, someone else can ** deal with that! */ Modified: trunk/numpy/core/setup.py =================================================================== --- trunk/numpy/core/setup.py 2008-10-05 07:00:33 UTC (rev 5912) +++ trunk/numpy/core/setup.py 2008-10-05 08:28:42 UTC (rev 5913) @@ -5,20 +5,6 @@ from numpy.distutils import log from distutils.dep_util import newer -FUNCTIONS_TO_CHECK = [ - ('expl', 'HAVE_LONGDOUBLE_FUNCS'), - ('expf', 'HAVE_FLOAT_FUNCS'), - ('log1p', 'HAVE_LOG1P'), - ('expm1', 'HAVE_EXPM1'), - ('asinh', 'HAVE_INVERSE_HYPERBOLIC'), - ('atanhf', 'HAVE_INVERSE_HYPERBOLIC_FLOAT'), - ('atanhl', 'HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE'), - ('isnan', 'HAVE_ISNAN'), - ('isinf', 'HAVE_ISINF'), - ('rint', 'HAVE_RINT'), - ('trunc', 'HAVE_TRUNC'), - ] - def is_npy_no_signal(): """Return True if the NPY_NO_SIGNAL symbol must be defined in configuration header.""" @@ -49,6 +35,75 @@ nosmp = 0 return nosmp == 1 +def check_math_capabilities(config, moredefs, mathlibs): + def check_func(func_name): + return config.check_func(func_name, libraries=mathlibs, + decl=True, call=True) + + def check_funcs_once(funcs_name): + decl = dict([(f, True) for f in funcs_name]) + st = config.check_funcs_once(funcs_name, libraries=mathlibs, + decl=decl, call=decl) + if st: + moredefs.extend([name_to_defsymb(f) for f in funcs_name]) + return st + + def check_funcs(funcs_name): + # Use check_funcs_once first, and if it does not work, test func per + # func. Return success only if all the functions are available + if not check_funcs_once(funcs_name): + # Global check failed, check func per func + for f in funcs_name: + if check_func(f): + moredefs.append(name_to_defsymb(f)) + return 0 + else: + return 1 + + def name_to_defsymb(name): + return "HAVE_%s" % name.upper() + + #use_msvc = config.check_decl("_MSC_VER") + + # Mandatory functions: if not found, fail the build + mandatory_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", + "floor", "ceil", "sqrt", "log10", "log", "exp", "asin", + "acos", "atan", "fmod", 'modf', 'frexp', 'ldexp'] + + if not check_funcs_once(mandatory_funcs): + raise SystemError("One of the required function to build numpy is not" + " available (the list is %s)." % str(mandatory_funcs)) + + # Standard functions which may not be available and for which we have a + # replacement implementation + # XXX: we do not test for hypot because python checks for it (HAVE_HYPOT in + # python.h... I wish they would clean their public headers someday) + optional_stdfuncs = ["expm1", "log1p", "acosh", "asinh", "atanh", + "rint", "trunc"] + + check_funcs(optional_stdfuncs) + + # C99 functions: float and long double versions + c99_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", "floor", + "ceil", "rint", "trunc", "sqrt", "log10", "log", "exp", + "expm1", "asin", "acos", "atan", "asinh", "acosh", "atanh", + "hypot", "atan2", "pow", "fmod", "modf", 'frexp', 'ldexp'] + + for prec in ['l', 'f']: + fns = [f + prec for f in c99_funcs] + check_funcs(fns) + + # Normally, isnan and isinf are macro (C99), but some platforms only have + # func, or both func and macro version. Check for macro only, and define + # replacement ones if not found. + # Note: including Python.h is necessary because it modifies some math.h + # definitions + for f in ["isnan", "isinf", "signbit", "isfinite"]: + st = config.check_decl(f, headers = ["Python.h", "math.h"]) + if st: + moredefs.append(name_to_defsymb("decl_%s" % f)) + + def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration,dot_join from numpy.distutils.system_info import get_info, default_lib_dirs @@ -106,15 +161,8 @@ ext.libraries.extend(mathlibs) moredefs.append(('MATHLIB',','.join(mathlibs))) - def check_func(func_name): - return config_cmd.check_func(func_name, - libraries=mathlibs, decl=False, - headers=['math.h']) + check_math_capabilities(config_cmd, moredefs, mathlibs) - for func_name, defsymbol in FUNCTIONS_TO_CHECK: - if check_func(func_name): - moredefs.append(defsymbol) - if is_npy_no_signal(): moredefs.append('__NPY_PRIVATE_NO_SIGNAL') @@ -136,6 +184,17 @@ target_f.write('#define %s\n' % (d)) else: target_f.write('#define %s %s\n' % (d[0],d[1])) + + # Keep those for backward compatibility for now + target_f.write(""" +#ifdef HAVE_EXPL +#define HAVE_LONGDOUBLE_FUNCS +#endif + +#ifdef HAVE_EXPF +#define HAVE_FLOAT_FUNCS +#endif +""") target_f.close() print 'File:',target target_f = open(target) @@ -264,7 +323,6 @@ join('src','scalartypes.inc.src'), join('src','arraytypes.inc.src'), join('src','_signbit.c'), - join('src','_isnan.c'), join('src','ucsnarrow.c'), join('include','numpy','*object.h'), 'include/numpy/fenv/fenv.c', @@ -298,6 +356,7 @@ generate_ufunc_api, join('src','scalartypes.inc.src'), join('src','arraytypes.inc.src'), + join('src','math_c99.inc.src'), ], depends = [join('src','ufuncobject.c'), generate_umath_py, Deleted: trunk/numpy/core/src/_isnan.c =================================================================== --- trunk/numpy/core/src/_isnan.c 2008-10-05 07:00:33 UTC (rev 5912) +++ trunk/numpy/core/src/_isnan.c 2008-10-05 08:28:42 UTC (rev 5913) @@ -1,46 +0,0 @@ -/* Adapted from cephes */ - -static int -isnan(double x) -{ - union - { - double d; - unsigned short s[4]; - unsigned int i[2]; - } u; - - u.d = x; - -#if SIZEOF_INT == 4 - -#ifdef WORDS_BIGENDIAN /* defined in pyconfig.h */ - if( ((u.i[0] & 0x7ff00000) == 0x7ff00000) - && (((u.i[0] & 0x000fffff) != 0) || (u.i[1] != 0))) - return 1; -#else - if( ((u.i[1] & 0x7ff00000) == 0x7ff00000) - && (((u.i[1] & 0x000fffff) != 0) || (u.i[0] != 0))) - return 1; -#endif - -#else /* SIZEOF_INT != 4 */ - -#ifdef WORDS_BIGENDIAN - if( (u.s[0] & 0x7ff0) == 0x7ff0) - { - if( ((u.s[0] & 0x000f) | u.s[1] | u.s[2] | u.s[3]) != 0 ) - return 1; - } -#else - if( (u.s[3] & 0x7ff0) == 0x7ff0) - { - if( ((u.s[3] & 0x000f) | u.s[2] | u.s[1] | u.s[0]) != 0 ) - return 1; - } -#endif - -#endif /* SIZEOF_INT */ - - return 0; -} Modified: trunk/numpy/core/src/_signbit.c =================================================================== --- trunk/numpy/core/src/_signbit.c 2008-10-05 07:00:33 UTC (rev 5912) +++ trunk/numpy/core/src/_signbit.c 2008-10-05 08:28:42 UTC (rev 5913) @@ -1,7 +1,7 @@ /* Adapted from cephes */ static int -signbit(double x) +signbit_d(double x) { union { Copied: trunk/numpy/core/src/math_c99.inc.src (from rev 5912, branches/clean_math_config/numpy/core/src/math_c99.inc.src) Modified: trunk/numpy/core/src/umathmodule.c.src =================================================================== --- trunk/numpy/core/src/umathmodule.c.src 2008-10-05 07:00:33 UTC (rev 5912) +++ trunk/numpy/core/src/umathmodule.c.src 2008-10-05 08:28:42 UTC (rev 5913) @@ -21,11 +21,7 @@ #define M_PI 3.14159265358979323846264338328 #endif -/* - ***************************************************************************** - ** BASIC MATH FUNCTIONS ** - ***************************************************************************** - */ +#include "math_c99.inc" float degreesf(float x) { return x * (float)(180.0/M_PI); @@ -47,591 +43,7 @@ return x * (M_PI/180.0L); } -/* - * A whole slew of basic math functions are provided originally - * by Konrad Hinsen. - */ - -#if !defined(__STDC__) && !defined(_MSC_VER) -extern double fmod (double, double); -extern double frexp (double, int *); -extern double ldexp (double, int); -extern double modf (double, double *); -#endif - - -#if defined(DISTUTILS_USE_SDK) -/* win32 on AMD64 build architecture */ -/* See also http://projects.scipy.org/scipy/numpy/ticket/164 */ -#ifndef HAVE_FABSF -#ifdef fabsf -#undef fabsf -#endif -static float fabsf(float x) -{ - return (float)fabs((double)(x)); -} -#endif -#ifndef HAVE_HYPOTF -static float hypotf(float x, float y) -{ - return (float)hypot((double)(x), (double)(y)); -} -#endif -#ifndef HAVE_RINTF -#ifndef HAVE_RINT -static double rint (double x); -#endif -static float rintf(float x) -{ - return (float)rint((double)(x)); -} -#endif -#ifndef HAVE_FREXPF -static float frexpf(float x, int * i) -{ - return (float)frexp((double)(x), i); -} -#endif -#ifndef HAVE_LDEXPF -static float ldexpf(float x, int i) -{ - return (float)ldexp((double)(x), i); -} -#endif -#define tanhf nc_tanhf -#endif - -#ifndef HAVE_INVERSE_HYPERBOLIC -static double acosh(double x) -{ - return 2*log(sqrt((x+1.0)/2)+sqrt((x-1.0)/2)); -} - -double log1p(double); -static double asinh(double xx) -{ - double x, d; - int sign; - if (xx < 0.0) { - sign = -1; - x = -xx; - } - else { - sign = 1; - x = xx; - } - if (x > 1e8) { - d = x; - } else { - d = sqrt(x*x + 1); - } - return sign*log1p(x*(1.0 + x/(d+1))); -} - -static double atanh(double x) -{ - return 0.5*log1p(2.0*x/(1.0-x)); -} -#endif - -#if !defined(HAVE_INVERSE_HYPERBOLIC_FLOAT) -#ifdef HAVE_FLOAT_FUNCS -#ifdef log1pf -#undef log1pf -#endif -#ifdef logf -#undef logf -#endif -#ifdef sqrtf -#undef sqrtf -#endif -float log1pf(float); -#ifdef DISTUTILS_USE_SDK -DL_IMPORT(float) logf(float); -DL_IMPORT(float) sqrtf(float); -#else -/* should these be extern?: */ -float logf(float); -float sqrtf(float); -#endif -#ifdef acoshf -#undef acoshf -#endif -static float acoshf(float x) -{ - return 2*logf(sqrtf((x+1)/2)+sqrtf((x-1)/2)); -} - -#ifdef asinhf -#undef asinhf -#endif -static float asinhf(float xx) -{ - float x, d; - int sign; - if (xx < 0) { - sign = -1; - x = -xx; - } - else { - sign = 1; - x = xx; - } - if (x > 1e5) { - d = x; - } else { - d = sqrtf(x*x + 1); - } - return sign*log1pf(x*(1 + x/(d+1))); -} - -#ifdef atanhf -#undef atanhf -#endif -static float atanhf(float x) -{ - return log1pf(2*x/(1-x))/2; -} -#else -#ifdef acoshf -#undef acoshf -#endif -static float acoshf(float x) -{ - return (float)acosh((double)(x)); -} - -#ifdef asinhf -#undef asinhf -#endif -static float asinhf(float x) -{ - return (float)asinh((double)(x)); -} - -#ifdef atanhf -#undef atanhf -#endif -static float atanhf(float x) -{ - return (float)atanh((double)(x)); -} -#endif -#endif - - -#if !defined(HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE) -#ifdef HAVE_LONGDOUBLE_FUNCS -#ifdef logl -#undef logl -#endif -#ifdef sqrtl -#undef sqrtl -#endif -#ifdef log1pl -#undef log1pl -#endif -longdouble logl(longdouble); -longdouble sqrtl(longdouble); -longdouble log1pl(longdouble); -#ifdef acoshl -#undef acoshl -#endif -static longdouble acoshl(longdouble x) -{ - return 2*logl(sqrtl((x+1.0)/2)+sqrtl((x-1.0)/2)); -} - -#ifdef asinhl -#undef asinhl -#endif -static longdouble asinhl(longdouble xx) -{ - longdouble x, d; - int sign; - if (xx < 0.0) { - sign = -1; - x = -xx; - } - else { - sign = 1; - x = xx; - } - if (x > 1e17) { - d = x; - } else { - d = sqrtl(x*x + 1); - } - return sign*log1pl(x*(1.0 + x/(d+1))); -} - -#ifdef atanhl -#undef atanhl -#endif -static longdouble atanhl(longdouble x) -{ - return 0.5*log1pl(2.0*x/(1.0-x)); -} - -#else - -#ifdef acoshl -#undef acoshl -#endif -static longdouble acoshl(longdouble x) -{ - return (longdouble)acosh((double)(x)); -} - -#ifdef asinhl -#undef asinhl -#endif -static longdouble asinhl(longdouble x) -{ - return (longdouble)asinh((double)(x)); -} - -#ifdef atanhl -#undef atanhl -#endif -static longdouble atanhl(longdouble x) -{ - return (longdouble)atanh((double)(x)); -} - -#endif -#endif - - -#ifdef HAVE_HYPOT -#if !defined(NeXT) && !defined(_MSC_VER) -extern double hypot(double, double); -#endif -#else -static double hypot(double x, double y) -{ - double yx; - - x = fabs(x); - y = fabs(y); - if (x < y) { - double temp = x; - x = y; - y = temp; - } - if (x == 0.) - return 0.; - else { - yx = y/x; - return x*sqrt(1.+yx*yx); - } -} -#endif - -#ifndef HAVE_RINT -/* needs cleanup */ -static double -rint(double x) -{ - double y, r; - - y = floor(x); - r = x - y; - - if (r > 0.5) goto rndup; - - /* Round to nearest even */ - if (r==0.5) { - r = y - 2.0*floor(0.5*y); - if (r==1.0) { - rndup: - y+=1.0; - } - } - return y; -} -#endif - /* - * Comment out trunc definition until build problems are fixed. - */ -/* -#ifndef HAVE_TRUNC -static double -trunc(double x) -{ - if (x < 0) { - return ceil(x); - } - else { - return floor(x); - } - -} -#endif -*/ - - - - -/* Define isnan, isinf, isfinite, signbit if needed */ -/* Use fpclassify if possible */ -/* isnan, isinf -- - these will use macros and then fpclassify if available before - defaulting to a dumb convert-to-double version... - - isfinite -- define a macro if not already available - signbit -- if macro available use it, otherwise define a function - and a dumb convert-to-double version for other types. -*/ - -#if defined(fpclassify) - -#if !defined(isnan) -#define isnan(x) (fpclassify(x) == FP_NAN) -#endif -#if !defined(isinf) -#define isinf(x) (fpclassify(x) == FP_INFINITE) -#endif - -#else /* check to see if already have a function like this */ - -#if !defined(HAVE_ISNAN) - -#if !defined(isnan) -#include "_isnan.c" -#endif -#endif /* HAVE_ISNAN */ - -#if !defined(HAVE_ISINF) -#if !defined(isinf) -#define isinf(x) (!isnan((x)) && isnan((x)-(x))) -#endif -#endif /* HAVE_ISINF */ - -#endif /* defined(fpclassify) */ - - -/* Define signbit if needed */ -#if !defined(signbit) -#include "_signbit.c" -#endif - -/* Now defined the extended type macros */ - -#if !defined(isnan) - -#if !defined(HAVE_LONGDOUBLE_FUNCS) || !defined(HAVE_ISNAN) -#define isnanl(x) isnan((double)(x)) -#endif - -#if !defined(HAVE_FLOAT_FUNCS) || !defined(HAVE_ISNAN) -#define isnanf(x) isnan((double)(x)) -#endif - -#else /* !defined(isnan) */ - -#define isnanl(x) isnan((x)) -#define isnanf(x) isnan((x)) - -#endif /* !defined(isnan) */ - - -#if !defined(isinf) - -#if !defined(HAVE_LONGDOUBLE_FUNCS) || !defined(HAVE_ISINF) -#define isinfl(x) (!isnanl((x)) && isnanl((x)-(x))) -#endif - -#if !defined(HAVE_FLOAT_FUNCS) || !defined(HAVE_ISINF) -#define isinff(x) (!isnanf((x)) && isnanf((x)-(x))) -#endif - -#else /* !defined(isinf) */ - -#define isinfl(x) isinf((x)) -#define isinff(x) isinf((x)) - -#endif /* !defined(isinf) */ - - -#if !defined(signbit) -#define signbitl(x) ((longdouble) signbit((double)(x))) -#define signbitf(x) ((float) signbit((double) (x))) -#else -#define signbitl(x) signbit((x)) -#define signbitf(x) signbit((x)) -#endif - -#if !defined(isfinite) -#define isfinite(x) (!(isinf((x)) || isnan((x)))) -#endif -#define isfinitef(x) (!(isinff((x)) || isnanf((x)))) -#define isfinitel(x) (!(isinfl((x)) || isnanl((x)))) - -/* First, the C functions that do the real work */ - -/* if C99 extensions not available then define dummy functions that use the - double versions for - - sin, cos, tan - sinh, cosh, tanh, - fabs, floor, ceil, fmod, sqrt, log10, log, exp, fabs - asin, acos, atan, - asinh, acosh, atanh - - hypot, atan2, pow -*/ - -/**begin repeat - - #kind=(sin,cos,tan,sinh,cosh,tanh,fabs,floor,ceil,sqrt,log10,log,exp,asin,acos,atan,rint)*2# - #typ=longdouble*17, float*17# - #c=l*17,f*17# - #TYPE=LONGDOUBLE*17, FLOAT*17# -*/ - -#ifndef HAVE_ at TYPE@_FUNCS -#ifdef @kind@@c@ -#undef @kind@@c@ -#endif - at typ@ @kind@@c@(@typ@ x) { - return (@typ@) @kind@((double)x); -} -#endif -/**end repeat**/ - -/**begin repeat - - #kind=(atan2,hypot,pow,fmod)*2# - #typ=longdouble*4, float*4# - #c=l*4,f*4# - #TYPE=LONGDOUBLE*4,FLOAT*4# -*/ -#ifndef HAVE_ at TYPE@_FUNCS -#ifdef @kind@@c@ -#undef @kind@@c@ -#endif - at typ@ @kind@@c@(@typ@ x, @typ@ y) { - return (@typ@) @kind@((double)x, (double) y); -} -#endif -/**end repeat**/ - -/**begin repeat - #kind=modf*2# - #typ=longdouble, float# - #c=l,f# - #TYPE=LONGDOUBLE, FLOAT# -*/ -#ifndef HAVE_ at TYPE@_FUNCS -#ifdef modf at c@ -#undef modf at c@ -#endif - at typ@ modf at c@(@typ@ x, @typ@ *iptr) { - double nx, niptr, y; - nx = (double) x; - y = modf(nx, &niptr); - *iptr = (@typ@) niptr; - return (@typ@) y; -} -#endif -/**end repeat**/ - - - -#ifndef HAVE_LOG1P -double log1p(double x) -{ - double u = 1. + x; - if (u == 1.0) { - return x; - } else { - return log(u) * x / (u-1.); - } -} -#endif - -#if !defined(HAVE_LOG1P) || !defined(HAVE_LONGDOUBLE_FUNCS) -#ifdef log1pl -#undef log1pl -#endif -longdouble log1pl(longdouble x) -{ - longdouble u = 1. + x; - if (u == 1.0) { - return x; - } else { - return logl(u) * x / (u-1.); - } -} -#endif - -#if !defined(HAVE_LOG1P) || !defined(HAVE_FLOAT_FUNCS) -#ifdef log1pf -#undef log1pf -#endif -float log1pf(float x) -{ - float u = 1 + x; - if (u == 1) { - return x; - } else { - return logf(u) * x / (u-1); - } -} -#endif - -#ifndef HAVE_EXPM1 -static double expm1(double x) -{ - double u = exp(x); - if (u == 1.0) { - return x; - } else if (u-1.0 == -1.0) { - return -1; - } else { - return (u-1.0) * x/log(u); - } -} -#endif - -#if !defined(HAVE_EXPM1) || !defined(HAVE_LONGDOUBLE_FUNCS) -#ifdef expml1 -#undef expml1 -#endif -static longdouble expm1l(longdouble x) -{ - longdouble u = expl(x); - if (u == 1.0) { - return x; - } else if (u-1.0 == -1.0) { - return -1; - } else { - return (u-1.0) * x/logl(u); - } -} -#endif - -#if !defined(HAVE_EXPM1) || !defined(HAVE_FLOAT_FUNCS) -#ifdef expm1f -#undef expm1f -#endif -static float expm1f(float x) -{ - float u = expf(x); - if (u == 1) { - return x; - } else if (u-1 == -1) { - return -1; - } else { - return (u-1) * x/logf(u); - } -} -#endif - -/* ***************************************************************************** ** PYTHON OBJECT FUNCTIONS ** ***************************************************************************** @@ -1701,8 +1113,7 @@ } } -#define HAVE_DOUBLE_FUNCS -#ifdef HAVE_ at TYPE@_FUNCS +#ifdef HAVE_FREXP at C@ static void @TYPE at _frexp(char **args, intp *dimensions, intp *steps, void *func) { @@ -1711,7 +1122,9 @@ *(@type@ *)op1 = frexp at c@(in1, (int *)op2); } } +#endif +#ifdef HAVE_LDEXP at C@ static void @TYPE at _ldexp(char **args, intp *dimensions, intp *steps, void *func) { @@ -1722,7 +1135,6 @@ } } #endif -#undef HAVE_DOUBLE_FUNCS #define @TYPE at _true_divide @TYPE at _divide @@ -2015,7 +1427,6 @@ #define @CTYPE at _true_divide @CTYPE at _divide /**end repeat**/ - /* ***************************************************************************** ** OBJECT LOOPS ** @@ -2036,7 +1447,6 @@ } /**end repeat**/ -static void OBJECT_sign(char **args, intp *dimensions, intp *steps, void *func) { PyObject *zero = PyInt_FromLong(0); @@ -2055,43 +1465,43 @@ static PyUFuncGenericFunction frexp_functions[] = { -#ifdef HAVE_FLOAT_FUNCS +#ifdef HAVE_FREXPF FLOAT_frexp, #endif DOUBLE_frexp -#ifdef HAVE_LONGDOUBLE_FUNCS +#ifdef HAVE_FREXPL ,LONGDOUBLE_frexp #endif }; static void * blank3_data[] = { (void *)NULL, (void *)NULL, (void *)NULL}; static char frexp_signatures[] = { -#ifdef HAVE_FLOAT_FUNCS +#ifdef HAVE_FREXPF PyArray_FLOAT, PyArray_FLOAT, PyArray_INT, #endif PyArray_DOUBLE, PyArray_DOUBLE, PyArray_INT -#ifdef HAVE_LONGDOUBLE_FUNCS +#ifdef HAVE_FREXPL ,PyArray_LONGDOUBLE, PyArray_LONGDOUBLE, PyArray_INT #endif }; static PyUFuncGenericFunction ldexp_functions[] = { -#ifdef HAVE_FLOAT_FUNCS +#ifdef HAVE_LDEXPF FLOAT_ldexp, #endif DOUBLE_ldexp -#ifdef HAVE_LONGDOUBLE_FUNCS +#ifdef HAVE_LDEXPL ,LONGDOUBLE_ldexp #endif }; static char ldexp_signatures[] = { -#ifdef HAVE_FLOAT_FUNCS +#ifdef HAVE_LDEXPF PyArray_FLOAT, PyArray_INT, PyArray_FLOAT, #endif PyArray_DOUBLE, PyArray_INT, PyArray_DOUBLE -#ifdef HAVE_LONGDOUBLE_FUNCS +#ifdef HAVE_LDEXPL ,PyArray_LONGDOUBLE, PyArray_INT, PyArray_LONGDOUBLE #endif }; @@ -2140,10 +1550,10 @@ PyObject *f; int num=1; -#ifdef HAVE_LONGDOUBLE_FUNCS +#ifdef HAVE_FREXPL num += 1; #endif -#ifdef HAVE_FLOAT_FUNCS +#ifdef HAVE_FREXPF num += 1; #endif f = PyUFunc_FromFuncAndData(frexp_functions, blank3_data, @@ -2154,6 +1564,13 @@ PyDict_SetItemString(dictionary, "frexp", f); Py_DECREF(f); + num = 1; +#ifdef HAVE_LDEXPL + num += 1; +#endif +#ifdef HAVE_LDEXPF + num += 1; +#endif f = PyUFunc_FromFuncAndData(ldexp_functions, blank3_data, ldexp_signatures, num, 2, 1, PyUFunc_None, "ldexp", "Compute y = x1 * 2**x2.",0); Modified: trunk/numpy/distutils/command/config.py =================================================================== --- trunk/numpy/distutils/command/config.py 2008-10-05 07:00:33 UTC (rev 5912) +++ trunk/numpy/distutils/command/config.py 2008-10-05 08:28:42 UTC (rev 5913) @@ -126,6 +126,13 @@ body = [] if decl: body.append("int %s ();" % func) + # Handle MSVC intrisincs: force MS compiler to make a function call. + # Useful to test for some functions when built with optimization on, to + # avoid build error because the intrisinc and our 'fake' test + # declaration do not match. + body.append("#ifdef _MSC_VER") + body.append("#pragma function(%s)" % func) + body.append("#endif") body.append("int main (void) {") if call: if call_args is None: @@ -140,6 +147,67 @@ return self.try_link(body, headers, include_dirs, libraries, library_dirs) + def check_funcs_once(self, funcs, + headers=None, include_dirs=None, + libraries=None, library_dirs=None, + decl=False, call=False, call_args=None): + """Check a list of functions at once. + + This is useful to speed up things, since all the functions in the funcs + list will be put in one compilation unit. + + Arguments + --------- + + funcs: seq + list of functions to test + include_dirs : seq + list of header paths + libraries : seq + list of libraries to link the code snippet to + libraru_dirs : seq + list of library paths + decl : dict + for every (key, value), the declaration in the value will be + used for function in key. If a function is not in the + dictionay, no declaration will be used. + call : dict + for every item (f, value), if the value is True, a call will be + done to the function f""" + self._check_compiler() + body = [] + if decl: + for f, v in decl.items(): + if v: + body.append("int %s ();" % f) + + # Handle MS intrinsics. See check_func for more info. + body.append("#ifdef _MSC_VER") + for func in funcs: + body.append("#pragma function(%s)" % func) + body.append("#endif") + + body.append("int main (void) {") + if call: + for f in funcs: + if call.has_key(f) and call[f]: + if not (call_args and call_args.has_key(f) and call_args[f]): + args = '' + else: + args = call_args[f] + body.append(" %s(%s);" % (f, args)) + else: + body.append(" %s;" % f) + else: + for f in funcs: + body.append(" %s;" % f) + body.append(" return 0;") + body.append("}") + body = '\n'.join(body) + "\n" + + return self.try_link(body, headers, include_dirs, + libraries, library_dirs) + def get_output(self, body, headers=None, include_dirs=None, libraries=None, library_dirs=None, lang="c"): From numpy-svn at scipy.org Sun Oct 5 04:41:29 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 03:41:29 -0500 (CDT) Subject: [Numpy-svn] r5914 - trunk Message-ID: <20081005084129.E646839C088@scipy.org> Author: cdavid Date: 2008-10-05 03:41:26 -0500 (Sun, 05 Oct 2008) New Revision: 5914 Modified: trunk/ Log: Removed merge tracking for "svnmerge" for http://svn.scipy.org/svn/numpy/branches/clean_math_config Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/aligned_alloca:1-5127 /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/clean_math_config:1-5912 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /cleaned_math_config:1-5731 /trunk:1-2871 + /branches/aligned_alloca:1-5127 /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /cleaned_math_config:1-5731 /trunk:1-2871 From numpy-svn at scipy.org Sun Oct 5 04:45:31 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 03:45:31 -0500 (CDT) Subject: [Numpy-svn] r5915 - branches Message-ID: <20081005084531.2D34339C088@scipy.org> Author: cdavid Date: 2008-10-05 03:45:26 -0500 (Sun, 05 Oct 2008) New Revision: 5915 Removed: branches/aligned_alloca/ Log: Remove aligned_alloca branch: discontinued work ATM. From numpy-svn at scipy.org Sun Oct 5 04:46:17 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 03:46:17 -0500 (CDT) Subject: [Numpy-svn] r5916 - trunk Message-ID: <20081005084617.4E5BA39C089@scipy.org> Author: cdavid Date: 2008-10-05 03:46:14 -0500 (Sun, 05 Oct 2008) New Revision: 5916 Modified: trunk/ Log: Removed merge tracking for "svnmerge" for http://svn.scipy.org/svn/numpy/branches/aligned_alloca Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/aligned_alloca:1-5127 /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /cleaned_math_config:1-5731 /trunk:1-2871 + /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /cleaned_math_config:1-5731 /trunk:1-2871 From numpy-svn at scipy.org Sun Oct 5 04:50:27 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 03:50:27 -0500 (CDT) Subject: [Numpy-svn] r5917 - trunk Message-ID: <20081005085027.1200339C088@scipy.org> Author: cdavid Date: 2008-10-05 03:50:24 -0500 (Sun, 05 Oct 2008) New Revision: 5917 Modified: trunk/ Log: Removed merge tracking for "svnmerge" for http://svn.scipy.org/svn/numpy/cleaned_math_config Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /cleaned_math_config:1-5731 /trunk:1-2871 + /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /trunk:1-2871 From numpy-svn at scipy.org Sun Oct 5 04:54:29 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 03:54:29 -0500 (CDT) Subject: [Numpy-svn] r5918 - trunk Message-ID: <20081005085429.612A139C088@scipy.org> Author: cdavid Date: 2008-10-05 03:54:26 -0500 (Sun, 05 Oct 2008) New Revision: 5918 Modified: trunk/ Log: Removed merge tracking for "svnmerge" for http://svn.scipy.org/svn/numpy/branches/cleanconfig_rtm Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /trunk:1-2871 + /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /trunk:1-2871 From numpy-svn at scipy.org Sun Oct 5 04:55:50 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 03:55:50 -0500 (CDT) Subject: [Numpy-svn] r5919 - trunk Message-ID: <20081005085550.17CBE39C088@scipy.org> Author: cdavid Date: 2008-10-05 03:55:47 -0500 (Sun, 05 Oct 2008) New Revision: 5919 Modified: trunk/ Log: Removed merge tracking for "svnmerge" for http://svn.scipy.org/svn/numpy/branches/numpy.scons Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /trunk:1-2871 + /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/vs_longstring:1-5656 /trunk:1-2871 From numpy-svn at scipy.org Sun Oct 5 04:56:32 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 03:56:32 -0500 (CDT) Subject: [Numpy-svn] r5920 - trunk Message-ID: <20081005085632.7D77539C088@scipy.org> Author: cdavid Date: 2008-10-05 03:56:29 -0500 (Sun, 05 Oct 2008) New Revision: 5920 Modified: trunk/ Log: Removed merge tracking for "svnmerge" for http://svn.scipy.org/svn/numpy/branches/cdavid Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/vs_longstring:1-5656 /trunk:1-2871 + /branches/build_with_scons:1-4676 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/vs_longstring:1-5656 /trunk:1-2871 From numpy-svn at scipy.org Sun Oct 5 04:56:57 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 03:56:57 -0500 (CDT) Subject: [Numpy-svn] r5921 - branches Message-ID: <20081005085657.DA06939C343@scipy.org> Author: cdavid Date: 2008-10-05 03:56:52 -0500 (Sun, 05 Oct 2008) New Revision: 5921 Removed: branches/cdavid/ Log: Obsolete branch: removed. From numpy-svn at scipy.org Sun Oct 5 04:58:33 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 03:58:33 -0500 (CDT) Subject: [Numpy-svn] r5922 - trunk Message-ID: <20081005085833.EAD4E39C088@scipy.org> Author: cdavid Date: 2008-10-05 03:58:30 -0500 (Sun, 05 Oct 2008) New Revision: 5922 Modified: trunk/ Log: Removed merge tracking for "svnmerge" for http://svn.scipy.org/svn/numpy/branches/distutils_scons_command Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/build_with_scons:1-4676 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/vs_longstring:1-5656 /trunk:1-2871 + /branches/build_with_scons:1-4676 /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /branches/vs_longstring:1-5656 /trunk:1-2871 From numpy-svn at scipy.org Sun Oct 5 05:00:30 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 04:00:30 -0500 (CDT) Subject: [Numpy-svn] r5923 - trunk Message-ID: <20081005090030.802B439C088@scipy.org> Author: cdavid Date: 2008-10-05 04:00:27 -0500 (Sun, 05 Oct 2008) New Revision: 5923 Modified: trunk/ Log: Removed merge tracking for "svnmerge" for http://svn.scipy.org/svn/numpy/branches/vs_longstring Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/build_with_scons:1-4676 /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /branches/vs_longstring:1-5656 /trunk:1-2871 + /branches/build_with_scons:1-4676 /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /trunk:1-2871 From numpy-svn at scipy.org Sun Oct 5 05:01:24 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 04:01:24 -0500 (CDT) Subject: [Numpy-svn] r5924 - trunk Message-ID: <20081005090124.A340839C088@scipy.org> Author: cdavid Date: 2008-10-05 04:01:20 -0500 (Sun, 05 Oct 2008) New Revision: 5924 Modified: trunk/ Log: Removed merge tracking for "svnmerge" for http://svn.scipy.org/svn/numpy/branches/build_with_scons Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/build_with_scons:1-4676 /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /trunk:1-2871 + /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /trunk:1-2871 From numpy-svn at scipy.org Sun Oct 5 05:02:14 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 04:02:14 -0500 (CDT) Subject: [Numpy-svn] r5925 - branches Message-ID: <20081005090214.EFA0739C088@scipy.org> Author: cdavid Date: 2008-10-05 04:02:11 -0500 (Sun, 05 Oct 2008) New Revision: 5925 Removed: branches/vs_longstring/ Log: Removed obsolete branch. From numpy-svn at scipy.org Sun Oct 5 05:28:15 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 04:28:15 -0500 (CDT) Subject: [Numpy-svn] r5926 - trunk/numpy/distutils/command Message-ID: <20081005092815.2B01C39C088@scipy.org> Author: cdavid Date: 2008-10-05 04:28:11 -0500 (Sun, 05 Oct 2008) New Revision: 5926 Modified: trunk/numpy/distutils/command/config.py Log: Fix function prototypes decl in check_func to avoid warning with -Wstrict-prototypes. Modified: trunk/numpy/distutils/command/config.py =================================================================== --- trunk/numpy/distutils/command/config.py 2008-10-05 09:02:11 UTC (rev 5925) +++ trunk/numpy/distutils/command/config.py 2008-10-05 09:28:11 UTC (rev 5926) @@ -125,7 +125,7 @@ self._check_compiler() body = [] if decl: - body.append("int %s ();" % func) + body.append("int %s (void);" % func) # Handle MSVC intrisincs: force MS compiler to make a function call. # Useful to test for some functions when built with optimization on, to # avoid build error because the intrisinc and our 'fake' test @@ -179,7 +179,7 @@ if decl: for f, v in decl.items(): if v: - body.append("int %s ();" % f) + body.append("int %s (void);" % f) # Handle MS intrinsics. See check_func for more info. body.append("#ifdef _MSC_VER") From numpy-svn at scipy.org Sun Oct 5 14:22:37 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 13:22:37 -0500 (CDT) Subject: [Numpy-svn] r5927 - branches/ufunc_cleanup/numpy/core/src Message-ID: <20081005182237.823DC39C089@scipy.org> Author: charris Date: 2008-10-05 13:22:35 -0500 (Sun, 05 Oct 2008) New Revision: 5927 Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src Log: Make it go. Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-05 09:28:11 UTC (rev 5926) +++ branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-05 18:22:35 UTC (rev 5927) @@ -16,17 +16,12 @@ #include "abstract.h" #include "config.h" #include -#include "numpy/WTF_MathExtras.h" #ifndef M_PI #define M_PI 3.14159265358979323846264338328 #endif -/* - ***************************************************************************** - ** BASIC MATH FUNCTIONS ** - ***************************************************************************** - */ +#include "math_c99.inc" float degreesf(float x) { return x * (float)(180.0/M_PI); @@ -49,590 +44,6 @@ } /* - * A whole slew of basic math functions are provided originally - * by Konrad Hinsen. - */ - -#if !defined(__STDC__) && !defined(_MSC_VER) -extern double fmod (double, double); -extern double frexp (double, int *); -extern double ldexp (double, int); -extern double modf (double, double *); -#endif - - -#if defined(DISTUTILS_USE_SDK) -/* win32 on AMD64 build architecture */ -/* See also http://projects.scipy.org/scipy/numpy/ticket/164 */ -#ifndef HAVE_FABSF -#ifdef fabsf -#undef fabsf -#endif -static float fabsf(float x) -{ - return (float)fabs((double)(x)); -} -#endif -#ifndef HAVE_HYPOTF -static float hypotf(float x, float y) -{ - return (float)hypot((double)(x), (double)(y)); -} -#endif -#ifndef HAVE_RINTF -#ifndef HAVE_RINT -static double rint (double x); -#endif -static float rintf(float x) -{ - return (float)rint((double)(x)); -} -#endif -#ifndef HAVE_FREXPF -static float frexpf(float x, int * i) -{ - return (float)frexp((double)(x), i); -} -#endif -#ifndef HAVE_LDEXPF -static float ldexpf(float x, int i) -{ - return (float)ldexp((double)(x), i); -} -#endif -#define tanhf nc_tanhf -#endif - -#ifndef HAVE_INVERSE_HYPERBOLIC -static double acosh(double x) -{ - return 2*log(sqrt((x+1.0)/2)+sqrt((x-1.0)/2)); -} - -double log1p(double); -static double asinh(double xx) -{ - double x, d; - int sign; - if (xx < 0.0) { - sign = -1; - x = -xx; - } - else { - sign = 1; - x = xx; - } - if (x > 1e8) { - d = x; - } else { - d = sqrt(x*x + 1); - } - return sign*log1p(x*(1.0 + x/(d+1))); -} - -static double atanh(double x) -{ - return 0.5*log1p(2.0*x/(1.0-x)); -} -#endif - -#if !defined(HAVE_INVERSE_HYPERBOLIC_FLOAT) -#ifdef HAVE_FLOAT_FUNCS -#ifdef log1pf -#undef log1pf -#endif -#ifdef logf -#undef logf -#endif -#ifdef sqrtf -#undef sqrtf -#endif -float log1pf(float); -#ifdef DISTUTILS_USE_SDK -DL_IMPORT(float) logf(float); -DL_IMPORT(float) sqrtf(float); -#else -/* should these be extern?: */ -float logf(float); -float sqrtf(float); -#endif -#ifdef acoshf -#undef acoshf -#endif -static float acoshf(float x) -{ - return 2*logf(sqrtf((x+1)/2)+sqrtf((x-1)/2)); -} - -#ifdef asinhf -#undef asinhf -#endif -static float asinhf(float xx) -{ - float x, d; - int sign; - if (xx < 0) { - sign = -1; - x = -xx; - } - else { - sign = 1; - x = xx; - } - if (x > 1e5) { - d = x; - } else { - d = sqrtf(x*x + 1); - } - return sign*log1pf(x*(1 + x/(d+1))); -} - -#ifdef atanhf -#undef atanhf -#endif -static float atanhf(float x) -{ - return log1pf(2*x/(1-x))/2; -} -#else -#ifdef acoshf -#undef acoshf -#endif -static float acoshf(float x) -{ - return (float)acosh((double)(x)); -} - -#ifdef asinhf -#undef asinhf -#endif -static float asinhf(float x) -{ - return (float)asinh((double)(x)); -} - -#ifdef atanhf -#undef atanhf -#endif -static float atanhf(float x) -{ - return (float)atanh((double)(x)); -} -#endif -#endif - - -#if !defined(HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE) -#ifdef HAVE_LONGDOUBLE_FUNCS -#ifdef logl -#undef logl -#endif -#ifdef sqrtl -#undef sqrtl -#endif -#ifdef log1pl -#undef log1pl -#endif -longdouble logl(longdouble); -longdouble sqrtl(longdouble); -longdouble log1pl(longdouble); -#ifdef acoshl -#undef acoshl -#endif -static longdouble acoshl(longdouble x) -{ - return 2*logl(sqrtl((x+1.0)/2)+sqrtl((x-1.0)/2)); -} - -#ifdef asinhl -#undef asinhl -#endif -static longdouble asinhl(longdouble xx) -{ - longdouble x, d; - int sign; - if (xx < 0.0) { - sign = -1; - x = -xx; - } - else { - sign = 1; - x = xx; - } - if (x > 1e17) { - d = x; - } else { - d = sqrtl(x*x + 1); - } - return sign*log1pl(x*(1.0 + x/(d+1))); -} - -#ifdef atanhl -#undef atanhl -#endif -static longdouble atanhl(longdouble x) -{ - return 0.5*log1pl(2.0*x/(1.0-x)); -} - -#else - -#ifdef acoshl -#undef acoshl -#endif -static longdouble acoshl(longdouble x) -{ - return (longdouble)acosh((double)(x)); -} - -#ifdef asinhl -#undef asinhl -#endif -static longdouble asinhl(longdouble x) -{ - return (longdouble)asinh((double)(x)); -} - -#ifdef atanhl -#undef atanhl -#endif -static longdouble atanhl(longdouble x) -{ - return (longdouble)atanh((double)(x)); -} - -#endif -#endif - - -#ifdef HAVE_HYPOT -#if !defined(NeXT) && !defined(_MSC_VER) -extern double hypot(double, double); -#endif -#else -static double hypot(double x, double y) -{ - double yx; - - x = fabs(x); - y = fabs(y); - if (x < y) { - double temp = x; - x = y; - y = temp; - } - if (x == 0.) - return 0.; - else { - yx = y/x; - return x*sqrt(1.+yx*yx); - } -} -#endif - -#ifndef HAVE_RINT -/* needs cleanup */ -static double -rint(double x) -{ - double y, r; - - y = floor(x); - r = x - y; - - if (r > 0.5) goto rndup; - - /* Round to nearest even */ - if (r==0.5) { - r = y - 2.0*floor(0.5*y); - if (r==1.0) { - rndup: - y+=1.0; - } - } - return y; -} -#endif - -/* - * Comment out trunc definition until build problems are fixed. - */ -/* -#ifndef HAVE_TRUNC -static double -trunc(double x) -{ - if (x < 0) { - return ceil(x); - } - else { - return floor(x); - } - -} -#endif -*/ - - - - -/* Define isnan, isinf, isfinite, signbit if needed */ -/* Use fpclassify if possible */ -/* isnan, isinf -- - these will use macros and then fpclassify if available before - defaulting to a dumb convert-to-double version... - - isfinite -- define a macro if not already available - signbit -- if macro available use it, otherwise define a function - and a dumb convert-to-double version for other types. -*/ - -#if defined(fpclassify) - -#if !defined(isnan) -#define isnan(x) (fpclassify(x) == FP_NAN) -#endif -#if !defined(isinf) -#define isinf(x) (fpclassify(x) == FP_INFINITE) -#endif - -#else /* check to see if already have a function like this */ - -#if !defined(HAVE_ISNAN) - -#if !defined(isnan) -#include "_isnan.c" -#endif -#endif /* HAVE_ISNAN */ - -#if !defined(HAVE_ISINF) -#if !defined(isinf) -#define isinf(x) (!isnan((x)) && isnan((x)-(x))) -#endif -#endif /* HAVE_ISINF */ - -#endif /* defined(fpclassify) */ - - -/* Define signbit if needed */ -#if !defined(signbit) -#include "_signbit.c" -#endif - -/* Now defined the extended type macros */ - -#if !defined(isnan) - -#if !defined(HAVE_LONGDOUBLE_FUNCS) || !defined(HAVE_ISNAN) -#define isnanl(x) isnan((double)(x)) -#endif - -#if !defined(HAVE_FLOAT_FUNCS) || !defined(HAVE_ISNAN) -#define isnanf(x) isnan((double)(x)) -#endif - -#else /* !defined(isnan) */ - -#define isnanl(x) isnan((x)) -#define isnanf(x) isnan((x)) - -#endif /* !defined(isnan) */ - - -#if !defined(isinf) - -#if !defined(HAVE_LONGDOUBLE_FUNCS) || !defined(HAVE_ISINF) -#define isinfl(x) (!isnanl((x)) && isnanl((x)-(x))) -#endif - -#if !defined(HAVE_FLOAT_FUNCS) || !defined(HAVE_ISINF) -#define isinff(x) (!isnanf((x)) && isnanf((x)-(x))) -#endif - -#else /* !defined(isinf) */ - -#define isinfl(x) isinf((x)) -#define isinff(x) isinf((x)) - -#endif /* !defined(isinf) */ - - -#if !defined(signbit) -#define signbitl(x) ((longdouble) signbit((double)(x))) -#define signbitf(x) ((float) signbit((double) (x))) -#else -#define signbitl(x) signbit((x)) -#define signbitf(x) signbit((x)) -#endif - -#if !defined(isfinite) -#define isfinite(x) (!(isinf((x)) || isnan((x)))) -#endif -#define isfinitef(x) (!(isinff((x)) || isnanf((x)))) -#define isfinitel(x) (!(isinfl((x)) || isnanl((x)))) - -/* First, the C functions that do the real work */ - -/* if C99 extensions not available then define dummy functions that use the - double versions for - - sin, cos, tan - sinh, cosh, tanh, - fabs, floor, ceil, fmod, sqrt, log10, log, exp, fabs - asin, acos, atan, - asinh, acosh, atanh - - hypot, atan2, pow -*/ - -/**begin repeat - - #kind=(sin,cos,tan,sinh,cosh,tanh,fabs,floor,ceil,sqrt,log10,log,exp,asin,acos,atan,rint)*2# - #typ=longdouble*17, float*17# - #c=l*17,f*17# - #TYPE=LONGDOUBLE*17, FLOAT*17# -*/ - -#ifndef HAVE_ at TYPE@_FUNCS -#ifdef @kind@@c@ -#undef @kind@@c@ -#endif - at typ@ @kind@@c@(@typ@ x) { - return (@typ@) @kind@((double)x); -} -#endif -/**end repeat**/ - -/**begin repeat - - #kind=(atan2,hypot,pow,fmod)*2# - #typ=longdouble*4, float*4# - #c=l*4,f*4# - #TYPE=LONGDOUBLE*4,FLOAT*4# -*/ -#ifndef HAVE_ at TYPE@_FUNCS -#ifdef @kind@@c@ -#undef @kind@@c@ -#endif - at typ@ @kind@@c@(@typ@ x, @typ@ y) { - return (@typ@) @kind@((double)x, (double) y); -} -#endif -/**end repeat**/ - -/**begin repeat - #kind=modf*2# - #typ=longdouble, float# - #c=l,f# - #TYPE=LONGDOUBLE, FLOAT# -*/ -#ifndef HAVE_ at TYPE@_FUNCS -#ifdef modf at c@ -#undef modf at c@ -#endif - at typ@ modf at c@(@typ@ x, @typ@ *iptr) { - double nx, niptr, y; - nx = (double) x; - y = modf(nx, &niptr); - *iptr = (@typ@) niptr; - return (@typ@) y; -} -#endif -/**end repeat**/ - - - -#ifndef HAVE_LOG1P -double log1p(double x) -{ - double u = 1. + x; - if (u == 1.0) { - return x; - } else { - return log(u) * x / (u-1.); - } -} -#endif - -#if !defined(HAVE_LOG1P) || !defined(HAVE_LONGDOUBLE_FUNCS) -#ifdef log1pl -#undef log1pl -#endif -longdouble log1pl(longdouble x) -{ - longdouble u = 1. + x; - if (u == 1.0) { - return x; - } else { - return logl(u) * x / (u-1.); - } -} -#endif - -#if !defined(HAVE_LOG1P) || !defined(HAVE_FLOAT_FUNCS) -#ifdef log1pf -#undef log1pf -#endif -float log1pf(float x) -{ - float u = 1 + x; - if (u == 1) { - return x; - } else { - return logf(u) * x / (u-1); - } -} -#endif - -#ifndef HAVE_EXPM1 -static double expm1(double x) -{ - double u = exp(x); - if (u == 1.0) { - return x; - } else if (u-1.0 == -1.0) { - return -1; - } else { - return (u-1.0) * x/log(u); - } -} -#endif - -#if !defined(HAVE_EXPM1) || !defined(HAVE_LONGDOUBLE_FUNCS) -#ifdef expml1 -#undef expml1 -#endif -static longdouble expm1l(longdouble x) -{ - longdouble u = expl(x); - if (u == 1.0) { - return x; - } else if (u-1.0 == -1.0) { - return -1; - } else { - return (u-1.0) * x/logl(u); - } -} -#endif - -#if !defined(HAVE_EXPM1) || !defined(HAVE_FLOAT_FUNCS) -#ifdef expm1f -#undef expm1f -#endif -static float expm1f(float x) -{ - float u = expf(x); - if (u == 1) { - return x; - } else if (u-1 == -1) { - return -1; - } else { - return (u-1) * x/logf(u); - } -} -#endif - -/* ***************************************************************************** ** PYTHON OBJECT FUNCTIONS ** ***************************************************************************** @@ -1700,7 +1111,15 @@ /* */ UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; - *((@type@ *)op) = in1 > 0 ? ONE : (in1 < 0 ? -ONE : ZERO); + if (in1 > 0) { + *((@type@ *)op) = 1; + } + else if (in1 < 0) { + *((@type@ *)op) = -1; + } + else { + *((@type@ *)op) = 0; + } } } @@ -1713,8 +1132,7 @@ } } -#define HAVE_DOUBLE_FUNCS -#ifdef HAVE_ at TYPE@_FUNCS +#ifdef HAVE_FREXP at C@ static void @TYPE at _frexp(char **args, intp *dimensions, intp *steps, void *func) { @@ -1723,7 +1141,9 @@ *(@type@ *)op1 = frexp at c@(in1, (int *)op2); } } +#endif +#ifdef HAVE_LDEXP at C@ static void @TYPE at _ldexp(char **args, intp *dimensions, intp *steps, void *func) { @@ -1734,7 +1154,6 @@ } } #endif -#undef HAVE_DOUBLE_FUNCS #define @TYPE at _true_divide @TYPE at _divide @@ -2076,7 +1495,6 @@ /**end repeat**/ - /* ***************************************************************************** ** OBJECT LOOPS ** @@ -2116,43 +1534,43 @@ static PyUFuncGenericFunction frexp_functions[] = { -#ifdef HAVE_FLOAT_FUNCS +#ifdef HAVE_FREXPF FLOAT_frexp, #endif DOUBLE_frexp -#ifdef HAVE_LONGDOUBLE_FUNCS +#ifdef HAVE_FREXPL ,LONGDOUBLE_frexp #endif }; static void * blank3_data[] = { (void *)NULL, (void *)NULL, (void *)NULL}; static char frexp_signatures[] = { -#ifdef HAVE_FLOAT_FUNCS +#ifdef HAVE_FREXPF PyArray_FLOAT, PyArray_FLOAT, PyArray_INT, #endif PyArray_DOUBLE, PyArray_DOUBLE, PyArray_INT -#ifdef HAVE_LONGDOUBLE_FUNCS +#ifdef HAVE_FREXPL ,PyArray_LONGDOUBLE, PyArray_LONGDOUBLE, PyArray_INT #endif }; static PyUFuncGenericFunction ldexp_functions[] = { -#ifdef HAVE_FLOAT_FUNCS +#ifdef HAVE_LDEXPF FLOAT_ldexp, #endif DOUBLE_ldexp -#ifdef HAVE_LONGDOUBLE_FUNCS +#ifdef HAVE_LDEXPL ,LONGDOUBLE_ldexp #endif }; static char ldexp_signatures[] = { -#ifdef HAVE_FLOAT_FUNCS +#ifdef HAVE_LDEXPF PyArray_FLOAT, PyArray_INT, PyArray_FLOAT, #endif PyArray_DOUBLE, PyArray_INT, PyArray_DOUBLE -#ifdef HAVE_LONGDOUBLE_FUNCS +#ifdef HAVE_LDEXPL ,PyArray_LONGDOUBLE, PyArray_INT, PyArray_LONGDOUBLE #endif }; @@ -2201,10 +1619,10 @@ PyObject *f; int num=1; -#ifdef HAVE_LONGDOUBLE_FUNCS +#ifdef HAVE_FREXPL num += 1; #endif -#ifdef HAVE_FLOAT_FUNCS +#ifdef HAVE_FREXPF num += 1; #endif f = PyUFunc_FromFuncAndData(frexp_functions, blank3_data, @@ -2215,6 +1633,13 @@ PyDict_SetItemString(dictionary, "frexp", f); Py_DECREF(f); + num = 1; +#ifdef HAVE_LDEXPL + num += 1; +#endif +#ifdef HAVE_LDEXPF + num += 1; +#endif f = PyUFunc_FromFuncAndData(ldexp_functions, blank3_data, ldexp_signatures, num, 2, 1, PyUFunc_None, "ldexp", "Compute y = x1 * 2**x2.",0); @@ -2312,7 +1737,7 @@ pinf = pinf_init(); pzero = pzero_init(); - mynan = copysign(pinf / pinf, 1); + mynan = pinf / pinf; PyModule_AddObject(m, "PINF", PyFloat_FromDouble(pinf)); PyModule_AddObject(m, "NINF", PyFloat_FromDouble(-pinf)); From numpy-svn at scipy.org Sun Oct 5 14:29:28 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 13:29:28 -0500 (CDT) Subject: [Numpy-svn] r5928 - in branches/ufunc_cleanup/numpy: core core/code_generators core/include/numpy core/src core/tests distutils/command Message-ID: <20081005182928.F27AA39C089@scipy.org> Author: charris Date: 2008-10-05 13:29:19 -0500 (Sun, 05 Oct 2008) New Revision: 5928 Added: branches/ufunc_cleanup/numpy/core/src/math_c99.inc.src Removed: branches/ufunc_cleanup/numpy/core/src/_isnan.c Modified: branches/ufunc_cleanup/numpy/core/SConscript branches/ufunc_cleanup/numpy/core/code_generators/numpy_api_order.txt branches/ufunc_cleanup/numpy/core/include/numpy/ufuncobject.h branches/ufunc_cleanup/numpy/core/setup.py branches/ufunc_cleanup/numpy/core/src/_signbit.c branches/ufunc_cleanup/numpy/core/src/arrayobject.c branches/ufunc_cleanup/numpy/core/src/multiarraymodule.c branches/ufunc_cleanup/numpy/core/tests/test_multiarray.py branches/ufunc_cleanup/numpy/distutils/command/config.py Log: Merge up to r5926. Modified: branches/ufunc_cleanup/numpy/core/SConscript =================================================================== --- branches/ufunc_cleanup/numpy/core/SConscript 2008-10-05 18:22:35 UTC (rev 5927) +++ branches/ufunc_cleanup/numpy/core/SConscript 2008-10-05 18:29:19 UTC (rev 5928) @@ -1,4 +1,4 @@ -# Last Change: Tue Aug 05 12:00 PM 2008 J +# Last Change: Fri Oct 03 04:00 PM 2008 J # vim:syntax=python import os import sys @@ -136,39 +136,56 @@ # Set value to 1 for each defined function (in math lib) mfuncs_defined = dict([(f, 0) for f in mfuncs]) -# TODO: checklib vs checkfunc ? -def check_func(f): - """Check that f is available in mlib, and add the symbol appropriately. """ - st = config.CheckDeclaration(f, language = 'C', includes = "#include ") - if st: - st = config.CheckFunc(f, language = 'C') - if st: - mfuncs_defined[f] = 1 - else: - mfuncs_defined[f] = 0 +# Check for mandatory funcs: we barf if a single one of those is not there +mandatory_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", +"floor", "ceil", "sqrt", "log10", "log", "exp", "asin", "acos", "atan", "fmod", +'modf', 'frexp', 'ldexp'] -for f in mfuncs: - check_func(f) +if not config.CheckFuncsAtOnce(mandatory_funcs): + raise SystemError("One of the required function to build numpy is not" + " available (the list is %s)." % str(mandatory_funcs)) -if mfuncs_defined['expl'] == 1: - config.Define('HAVE_LONGDOUBLE_FUNCS', - comment = 'Define to 1 if long double funcs are available') -if mfuncs_defined['expf'] == 1: - config.Define('HAVE_FLOAT_FUNCS', - comment = 'Define to 1 if long double funcs are available') -if mfuncs_defined['asinh'] == 1: - config.Define('HAVE_INVERSE_HYPERBOLIC', - comment = 'Define to 1 if inverse hyperbolic funcs are '\ - 'available') -if mfuncs_defined['atanhf'] == 1: - config.Define('HAVE_INVERSE_HYPERBOLIC_FLOAT', - comment = 'Define to 1 if inverse hyperbolic float funcs '\ - 'are available') -if mfuncs_defined['atanhl'] == 1: - config.Define('HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE', - comment = 'Define to 1 if inverse hyperbolic long double '\ - 'funcs are available') +# Standard functions which may not be available and for which we have a +# replacement implementation +# +def check_funcs(funcs): + # Use check_funcs_once first, and if it does not work, test func per + # func. Return success only if all the functions are available + st = config.CheckFuncsAtOnce(funcs) + if not st: + # Global check failed, check func per func + for f in funcs: + st = config.CheckFunc(f, language = 'C') +# XXX: we do not test for hypot because python checks for it (HAVE_HYPOT in +# python.h... I wish they would clean their public headers someday) +optional_stdfuncs = ["expm1", "log1p", "acosh", "asinh", "atanh", + "rint", "trunc"] + +check_funcs(optional_stdfuncs) + +# C99 functions: float and long double versions +c99_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", "floor", + "ceil", "rint", "trunc", "sqrt", "log10", "log", "exp", + "expm1", "asin", "acos", "atan", "asinh", "acosh", "atanh", + "hypot", "atan2", "pow", "fmod", "modf", 'frexp', 'ldexp'] + +for prec in ['l', 'f']: + fns = [f + prec for f in c99_funcs] + check_funcs(fns) + +# Normally, isnan and isinf are macro (C99), but some platforms only have +# func, or both func and macro version. Check for macro only, and define +# replacement ones if not found. +# Note: including Python.h is necessary because it modifies some math.h +# definitions +for f in ["isnan", "isinf", "signbit", "isfinite"]: + includes = """\ +#include +#include +""" + config.CheckDeclaration(f, includes=includes) + #------------------------------------------------------- # Define the function PyOS_ascii_strod if not available #------------------------------------------------------- @@ -234,6 +251,7 @@ # Generate generated code #------------------------ scalartypes_src = env.GenerateFromTemplate(pjoin('src', 'scalartypes.inc.src')) +math_c99_src = env.GenerateFromTemplate(pjoin('src', 'math_c99.inc.src')) arraytypes_src = env.GenerateFromTemplate(pjoin('src', 'arraytypes.inc.src')) sortmodule_src = env.GenerateFromTemplate(pjoin('src', '_sortmodule.c.src')) umathmodule_src = env.GenerateFromTemplate(pjoin('src', 'umathmodule.c.src')) Modified: branches/ufunc_cleanup/numpy/core/code_generators/numpy_api_order.txt =================================================================== --- branches/ufunc_cleanup/numpy/core/code_generators/numpy_api_order.txt 2008-10-05 18:22:35 UTC (rev 5927) +++ branches/ufunc_cleanup/numpy/core/code_generators/numpy_api_order.txt 2008-10-05 18:29:19 UTC (rev 5928) @@ -170,3 +170,4 @@ PyArray_CheckAxis PyArray_OverflowMultiplyList PyArray_CompareString +PyArray_MultiIterFromObjects Modified: branches/ufunc_cleanup/numpy/core/include/numpy/ufuncobject.h =================================================================== --- branches/ufunc_cleanup/numpy/core/include/numpy/ufuncobject.h 2008-10-05 18:22:35 UTC (rev 5927) +++ branches/ufunc_cleanup/numpy/core/include/numpy/ufuncobject.h 2008-10-05 18:29:19 UTC (rev 5928) @@ -263,11 +263,6 @@ | ((SW_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \ } -#define isnan(x) (_isnan((double)(x))) -#define isinf(x) ((_fpclass((double)(x)) == _FPCLASS_PINF) || \ - (_fpclass((double)(x)) == _FPCLASS_NINF)) -#define isfinite(x) (_finite((double) x)) - /* Solaris --------------------------------------------------------*/ /* --------ignoring SunOS ieee_flags approach, someone else can ** deal with that! */ Modified: branches/ufunc_cleanup/numpy/core/setup.py =================================================================== --- branches/ufunc_cleanup/numpy/core/setup.py 2008-10-05 18:22:35 UTC (rev 5927) +++ branches/ufunc_cleanup/numpy/core/setup.py 2008-10-05 18:29:19 UTC (rev 5928) @@ -5,20 +5,6 @@ from numpy.distutils import log from distutils.dep_util import newer -FUNCTIONS_TO_CHECK = [ - ('expl', 'HAVE_LONGDOUBLE_FUNCS'), - ('expf', 'HAVE_FLOAT_FUNCS'), - ('log1p', 'HAVE_LOG1P'), - ('expm1', 'HAVE_EXPM1'), - ('asinh', 'HAVE_INVERSE_HYPERBOLIC'), - ('atanhf', 'HAVE_INVERSE_HYPERBOLIC_FLOAT'), - ('atanhl', 'HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE'), - ('isnan', 'HAVE_ISNAN'), - ('isinf', 'HAVE_ISINF'), - ('rint', 'HAVE_RINT'), - ('trunc', 'HAVE_TRUNC'), - ] - def is_npy_no_signal(): """Return True if the NPY_NO_SIGNAL symbol must be defined in configuration header.""" @@ -49,6 +35,75 @@ nosmp = 0 return nosmp == 1 +def check_math_capabilities(config, moredefs, mathlibs): + def check_func(func_name): + return config.check_func(func_name, libraries=mathlibs, + decl=True, call=True) + + def check_funcs_once(funcs_name): + decl = dict([(f, True) for f in funcs_name]) + st = config.check_funcs_once(funcs_name, libraries=mathlibs, + decl=decl, call=decl) + if st: + moredefs.extend([name_to_defsymb(f) for f in funcs_name]) + return st + + def check_funcs(funcs_name): + # Use check_funcs_once first, and if it does not work, test func per + # func. Return success only if all the functions are available + if not check_funcs_once(funcs_name): + # Global check failed, check func per func + for f in funcs_name: + if check_func(f): + moredefs.append(name_to_defsymb(f)) + return 0 + else: + return 1 + + def name_to_defsymb(name): + return "HAVE_%s" % name.upper() + + #use_msvc = config.check_decl("_MSC_VER") + + # Mandatory functions: if not found, fail the build + mandatory_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", + "floor", "ceil", "sqrt", "log10", "log", "exp", "asin", + "acos", "atan", "fmod", 'modf', 'frexp', 'ldexp'] + + if not check_funcs_once(mandatory_funcs): + raise SystemError("One of the required function to build numpy is not" + " available (the list is %s)." % str(mandatory_funcs)) + + # Standard functions which may not be available and for which we have a + # replacement implementation + # XXX: we do not test for hypot because python checks for it (HAVE_HYPOT in + # python.h... I wish they would clean their public headers someday) + optional_stdfuncs = ["expm1", "log1p", "acosh", "asinh", "atanh", + "rint", "trunc"] + + check_funcs(optional_stdfuncs) + + # C99 functions: float and long double versions + c99_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", "floor", + "ceil", "rint", "trunc", "sqrt", "log10", "log", "exp", + "expm1", "asin", "acos", "atan", "asinh", "acosh", "atanh", + "hypot", "atan2", "pow", "fmod", "modf", 'frexp', 'ldexp'] + + for prec in ['l', 'f']: + fns = [f + prec for f in c99_funcs] + check_funcs(fns) + + # Normally, isnan and isinf are macro (C99), but some platforms only have + # func, or both func and macro version. Check for macro only, and define + # replacement ones if not found. + # Note: including Python.h is necessary because it modifies some math.h + # definitions + for f in ["isnan", "isinf", "signbit", "isfinite"]: + st = config.check_decl(f, headers = ["Python.h", "math.h"]) + if st: + moredefs.append(name_to_defsymb("decl_%s" % f)) + + def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration,dot_join from numpy.distutils.system_info import get_info, default_lib_dirs @@ -106,15 +161,8 @@ ext.libraries.extend(mathlibs) moredefs.append(('MATHLIB',','.join(mathlibs))) - def check_func(func_name): - return config_cmd.check_func(func_name, - libraries=mathlibs, decl=False, - headers=['math.h']) + check_math_capabilities(config_cmd, moredefs, mathlibs) - for func_name, defsymbol in FUNCTIONS_TO_CHECK: - if check_func(func_name): - moredefs.append(defsymbol) - if is_npy_no_signal(): moredefs.append('__NPY_PRIVATE_NO_SIGNAL') @@ -136,6 +184,17 @@ target_f.write('#define %s\n' % (d)) else: target_f.write('#define %s %s\n' % (d[0],d[1])) + + # Keep those for backward compatibility for now + target_f.write(""" +#ifdef HAVE_EXPL +#define HAVE_LONGDOUBLE_FUNCS +#endif + +#ifdef HAVE_EXPF +#define HAVE_FLOAT_FUNCS +#endif +""") target_f.close() print 'File:',target target_f = open(target) @@ -264,7 +323,6 @@ join('src','scalartypes.inc.src'), join('src','arraytypes.inc.src'), join('src','_signbit.c'), - join('src','_isnan.c'), join('src','ucsnarrow.c'), join('include','numpy','*object.h'), 'include/numpy/fenv/fenv.c', @@ -298,6 +356,7 @@ generate_ufunc_api, join('src','scalartypes.inc.src'), join('src','arraytypes.inc.src'), + join('src','math_c99.inc.src'), ], depends = [join('src','ufuncobject.c'), generate_umath_py, Deleted: branches/ufunc_cleanup/numpy/core/src/_isnan.c =================================================================== --- branches/ufunc_cleanup/numpy/core/src/_isnan.c 2008-10-05 18:22:35 UTC (rev 5927) +++ branches/ufunc_cleanup/numpy/core/src/_isnan.c 2008-10-05 18:29:19 UTC (rev 5928) @@ -1,46 +0,0 @@ -/* Adapted from cephes */ - -static int -isnan(double x) -{ - union - { - double d; - unsigned short s[4]; - unsigned int i[2]; - } u; - - u.d = x; - -#if SIZEOF_INT == 4 - -#ifdef WORDS_BIGENDIAN /* defined in pyconfig.h */ - if( ((u.i[0] & 0x7ff00000) == 0x7ff00000) - && (((u.i[0] & 0x000fffff) != 0) || (u.i[1] != 0))) - return 1; -#else - if( ((u.i[1] & 0x7ff00000) == 0x7ff00000) - && (((u.i[1] & 0x000fffff) != 0) || (u.i[0] != 0))) - return 1; -#endif - -#else /* SIZEOF_INT != 4 */ - -#ifdef WORDS_BIGENDIAN - if( (u.s[0] & 0x7ff0) == 0x7ff0) - { - if( ((u.s[0] & 0x000f) | u.s[1] | u.s[2] | u.s[3]) != 0 ) - return 1; - } -#else - if( (u.s[3] & 0x7ff0) == 0x7ff0) - { - if( ((u.s[3] & 0x000f) | u.s[2] | u.s[1] | u.s[0]) != 0 ) - return 1; - } -#endif - -#endif /* SIZEOF_INT */ - - return 0; -} Modified: branches/ufunc_cleanup/numpy/core/src/_signbit.c =================================================================== --- branches/ufunc_cleanup/numpy/core/src/_signbit.c 2008-10-05 18:22:35 UTC (rev 5927) +++ branches/ufunc_cleanup/numpy/core/src/_signbit.c 2008-10-05 18:29:19 UTC (rev 5928) @@ -1,7 +1,7 @@ /* Adapted from cephes */ static int -signbit(double x) +signbit_d(double x) { union { Modified: branches/ufunc_cleanup/numpy/core/src/arrayobject.c =================================================================== --- branches/ufunc_cleanup/numpy/core/src/arrayobject.c 2008-10-05 18:22:35 UTC (rev 5927) +++ branches/ufunc_cleanup/numpy/core/src/arrayobject.c 2008-10-05 18:29:19 UTC (rev 5928) @@ -10790,6 +10790,75 @@ /** END of Subscript Iterator **/ +/* + NUMPY_API + Get MultiIterator from array of Python objects and any additional + + PyObject **mps -- array of PyObjects + int n - number of PyObjects in the array + int nadd - number of additional arrays to include in the + iterator. + + Returns a multi-iterator object. + */ +static PyObject * +PyArray_MultiIterFromObjects(PyObject **mps, int n, int nadd, ...) +{ + va_list va; + PyArrayMultiIterObject *multi; + PyObject *current; + PyObject *arr; + + int i, ntot, err=0; + + ntot = n + nadd; + if (ntot < 2 || ntot > NPY_MAXARGS) { + PyErr_Format(PyExc_ValueError, + "Need between 2 and (%d) " \ + "array objects (inclusive).", NPY_MAXARGS); + return NULL; + } + + multi = _pya_malloc(sizeof(PyArrayMultiIterObject)); + if (multi == NULL) return PyErr_NoMemory(); + PyObject_Init((PyObject *)multi, &PyArrayMultiIter_Type); + + for(i=0; iiters[i] = NULL; + multi->numiter = ntot; + multi->index = 0; + + va_start(va, nadd); + for(i=0; iiters[i] = (PyArrayIterObject *)PyArray_IterNew(arr); + Py_DECREF(arr); + } + } + + va_end(va); + + if (!err && PyArray_Broadcast(multi) < 0) err=1; + + if (err) { + Py_DECREF(multi); + return NULL; + } + + PyArray_MultiIter_RESET(multi); + + return (PyObject *)multi; +} + /*NUMPY_API Get MultiIterator, */ Copied: branches/ufunc_cleanup/numpy/core/src/math_c99.inc.src (from rev 5926, trunk/numpy/core/src/math_c99.inc.src) Modified: branches/ufunc_cleanup/numpy/core/src/multiarraymodule.c =================================================================== --- branches/ufunc_cleanup/numpy/core/src/multiarraymodule.c 2008-10-05 18:22:35 UTC (rev 5927) +++ branches/ufunc_cleanup/numpy/core/src/multiarraymodule.c 2008-10-05 18:29:19 UTC (rev 5928) @@ -2326,50 +2326,40 @@ PyArray_Choose(PyArrayObject *ip, PyObject *op, PyArrayObject *ret, NPY_CLIPMODE clipmode) { - intp *sizes, offset; int n, elsize; intp i, m; char *ret_data; PyArrayObject **mps, *ap; - intp *self_data, mi; + PyArrayMultiIterObject *multi=NULL; + intp mi; int copyret=0; ap = NULL; /* Convert all inputs to arrays of a common type */ + /* Also makes them C-contiguous */ mps = PyArray_ConvertToCommonType(op, &n); if (mps == NULL) return NULL; - sizes = (intp *)_pya_malloc(n*sizeof(intp)); - if (sizes == NULL) goto fail; - - ap = (PyArrayObject *)PyArray_ContiguousFromAny((PyObject *)ip, - PyArray_INTP, - 0, 0); - if (ap == NULL) goto fail; - - /* Check the dimensions of the arrays */ for(i=0; ind < mps[i]->nd) { - PyErr_SetString(PyExc_ValueError, - "too many dimensions"); - goto fail; - } - if (!PyArray_CompareLists(ap->dimensions+(ap->nd-mps[i]->nd), - mps[i]->dimensions, mps[i]->nd)) { - PyErr_SetString(PyExc_ValueError, - "array dimensions must agree"); - goto fail; - } - sizes[i] = PyArray_NBYTES(mps[i]); } + ap = (PyArrayObject *)PyArray_FROM_OT((PyObject *)ip, NPY_INTP); + + if (ap == NULL) goto fail; + + /* Broadcast all arrays to each other, index array at the end. */ + multi = (PyArrayMultiIterObject *)\ + PyArray_MultiIterFromObjects((PyObject **)mps, n, 1, ap); + if (multi == NULL) goto fail; + + /* Set-up return array */ if (!ret) { Py_INCREF(mps[0]->descr); ret = (PyArrayObject *)PyArray_NewFromDescr(ap->ob_type, mps[0]->descr, - ap->nd, - ap->dimensions, + multi->nd, + multi->dimensions, NULL, NULL, 0, (PyObject *)ap); } @@ -2377,8 +2367,10 @@ PyArrayObject *obj; int flags = NPY_CARRAY | NPY_UPDATEIFCOPY | NPY_FORCECAST; - if (PyArray_SIZE(ret) != PyArray_SIZE(ap)) { - PyErr_SetString(PyExc_TypeError, + if ((PyArray_NDIM(ret) != multi->nd) || + !PyArray_CompareLists(PyArray_DIMS(ret), multi->dimensions, + multi->nd)) { + PyErr_SetString(PyExc_TypeError, "invalid shape for output array."); ret = NULL; goto fail; @@ -2399,12 +2391,10 @@ if (ret == NULL) goto fail; elsize = ret->descr->elsize; - m = PyArray_SIZE(ret); - self_data = (intp *)ap->data; ret_data = ret->data; - for (i=0; i= n) { switch(clipmode) { case NPY_RAISE: @@ -2426,17 +2416,16 @@ break; } } - offset = i*elsize; - if (offset >= sizes[mi]) {offset = offset % sizes[mi]; } - memmove(ret_data, mps[mi]->data+offset, elsize); - ret_data += elsize; self_data++; + memmove(ret_data, PyArray_MultiIter_DATA(multi, mi), elsize); + ret_data += elsize; + PyArray_MultiIter_NEXT(multi); } PyArray_INCREF(ret); + Py_DECREF(multi); for(i=0; ibase; @@ -2447,10 +2436,10 @@ return (PyObject *)ret; fail: + Py_XDECREF(multi); for(i=0; i Author: charris Date: 2008-10-05 13:52:29 -0500 (Sun, 05 Oct 2008) New Revision: 5929 Modified: branches/ufunc_cleanup/ Log: Testing Property changes on: branches/ufunc_cleanup ___________________________________________________________________ Name: svnmerge-integrated - /branches/aligned_alloca:1-5127 /branches/build_with_scons:1-4676 /branches/cdavid:1-5257 /branches/clean_math_config:1-5736 /branches/cleanconfig_rtm:1-4677 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /branches/vs_longstring:1-5656 /cleaned_math_config:1-5731 /trunk:1-2871 + /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /trunk:1-2871 From numpy-svn at scipy.org Sun Oct 5 15:06:46 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 14:06:46 -0500 (CDT) Subject: [Numpy-svn] r5930 - branches/ufunc_cleanup/numpy/core/src Message-ID: <20081005190646.42B8F39C088@scipy.org> Author: charris Date: 2008-10-05 14:06:41 -0500 (Sun, 05 Oct 2008) New Revision: 5930 Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src Log: Move location of some includes for clarity. Name ufunc setup section. Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-05 18:52:29 UTC (rev 5929) +++ branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-05 19:06:41 UTC (rev 5930) @@ -106,7 +106,7 @@ */ -/* +/* * Don't pass structures between functions (only pointers) because how * structures are passed is compiler dependent and could cause * segfaults if ufuncobject.c is compiled with a different compiler @@ -1533,6 +1533,16 @@ */ +/* + ***************************************************************************** + ** SETUP UFUNCS ** + ***************************************************************************** + */ + +#include "__umath_generated.c" +#include "ufuncobject.c" +#include "__ufunc_api.c" + static PyUFuncGenericFunction frexp_functions[] = { #ifdef HAVE_FREXPF FLOAT_frexp, @@ -1554,7 +1564,6 @@ #endif }; - static PyUFuncGenericFunction ldexp_functions[] = { #ifdef HAVE_LDEXPF FLOAT_ldexp, @@ -1576,10 +1585,6 @@ }; -#include "__umath_generated.c" -#include "ufuncobject.c" -#include "__ufunc_api.c" - static double pinf_init(void) { From numpy-svn at scipy.org Sun Oct 5 15:14:15 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 14:14:15 -0500 (CDT) Subject: [Numpy-svn] r5931 - branches Message-ID: <20081005191415.6AB1C39C088@scipy.org> Author: charris Date: 2008-10-05 14:14:13 -0500 (Sun, 05 Oct 2008) New Revision: 5931 Removed: branches/clean_math_config_chuck/ Log: Remove obsolete branch. From numpy-svn at scipy.org Sun Oct 5 15:15:32 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 14:15:32 -0500 (CDT) Subject: [Numpy-svn] r5932 - branches Message-ID: <20081005191532.9512639C089@scipy.org> Author: charris Date: 2008-10-05 14:15:30 -0500 (Sun, 05 Oct 2008) New Revision: 5932 Removed: branches/splitcode/ Log: Remove obsolete branch. From numpy-svn at scipy.org Sun Oct 5 17:03:36 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 16:03:36 -0500 (CDT) Subject: [Numpy-svn] r5933 - branches/ufunc_cleanup/numpy/core/src Message-ID: <20081005210336.ECD0E39C088@scipy.org> Author: charris Date: 2008-10-05 16:03:34 -0500 (Sun, 05 Oct 2008) New Revision: 5933 Modified: branches/ufunc_cleanup/numpy/core/src/math_c99.inc.src Log: Add WTF_MathExtras.h to math_c99.inc.src for testing. Modified: branches/ufunc_cleanup/numpy/core/src/math_c99.inc.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/math_c99.inc.src 2008-10-05 19:15:30 UTC (rev 5932) +++ branches/ufunc_cleanup/numpy/core/src/math_c99.inc.src 2008-10-05 21:03:34 UTC (rev 5933) @@ -11,6 +11,8 @@ ***************************************************************************** */ +#include "numpy/WTF_MathExtras.h" + /* Original code by Konrad Hinsen. */ #ifndef HAVE_EXPM1 double expm1(double x) From numpy-svn at scipy.org Sun Oct 5 18:22:07 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 17:22:07 -0500 (CDT) Subject: [Numpy-svn] r5934 - branches/ufunc_cleanup/numpy/core/src Message-ID: <20081005222207.D658439C088@scipy.org> Author: charris Date: 2008-10-05 17:22:04 -0500 (Sun, 05 Oct 2008) New Revision: 5934 Modified: branches/ufunc_cleanup/numpy/core/src/math_c99.inc.src Log: Remove test include. Modified: branches/ufunc_cleanup/numpy/core/src/math_c99.inc.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/math_c99.inc.src 2008-10-05 21:03:34 UTC (rev 5933) +++ branches/ufunc_cleanup/numpy/core/src/math_c99.inc.src 2008-10-05 22:22:04 UTC (rev 5934) @@ -11,7 +11,6 @@ ***************************************************************************** */ -#include "numpy/WTF_MathExtras.h" /* Original code by Konrad Hinsen. */ #ifndef HAVE_EXPM1 From numpy-svn at scipy.org Sun Oct 5 22:55:16 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 5 Oct 2008 21:55:16 -0500 (CDT) Subject: [Numpy-svn] r5935 - branches/1.2.x/numpy Message-ID: <20081006025516.507D139C088@scipy.org> Author: jarrod.millman Date: 2008-10-05 21:55:14 -0500 (Sun, 05 Oct 2008) New Revision: 5935 Modified: branches/1.2.x/numpy/version.py Log: branch open for 1.2.1 development Modified: branches/1.2.x/numpy/version.py =================================================================== --- branches/1.2.x/numpy/version.py 2008-10-05 22:22:04 UTC (rev 5934) +++ branches/1.2.x/numpy/version.py 2008-10-06 02:55:14 UTC (rev 5935) @@ -1,4 +1,4 @@ -version='1.2.0' +version='1.2.1' release=False if not release: From numpy-svn at scipy.org Mon Oct 6 17:05:09 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 6 Oct 2008 16:05:09 -0500 (CDT) Subject: [Numpy-svn] r5936 - in branches/1.2.x/numpy/ma: . tests Message-ID: <20081006210509.56FA039C089@scipy.org> Author: pierregm Date: 2008-10-06 16:05:03 -0500 (Mon, 06 Oct 2008) New Revision: 5936 Modified: branches/1.2.x/numpy/ma/core.py branches/1.2.x/numpy/ma/extras.py branches/1.2.x/numpy/ma/mrecords.py branches/1.2.x/numpy/ma/tests/test_core.py branches/1.2.x/numpy/ma/tests/test_extras.py branches/1.2.x/numpy/ma/tests/test_mrecords.py branches/1.2.x/numpy/ma/tests/test_subclassing.py branches/1.2.x/numpy/ma/testutils.py branches/1.2.x/numpy/ma/timer_comparison.py Log: Backporting bug fixes: core: MaskedArray * __new__ : make sure that hard_mask is not overwritten by default [r5824] * __array_finalize__ : force flexible-type masked arrays to have a full mask of False by default * view : add support for optional parameters * __getitem__ : fixed for flexible-type * __str__ : fixed for flexible-type [r5835] * repr : fixed for flexible-type [r5835] * __deepcopy__ : introduced [r5791] * concatenate : fixed for flexible-type [r5869] * count : simplified to call the method on masked arrays instead of recreating an array * minimum/maximum : ensure that a masked array is returned [r5800] extras * fixed median on nD arrays (w/ n!=1) [r5831] mrecords * fixed fromrecords * fixed __str__ and repr for MaskedRecords [r5835] testutils * prevent the use of plain assert in tests [r5879] Modified: branches/1.2.x/numpy/ma/core.py =================================================================== --- branches/1.2.x/numpy/ma/core.py 2008-10-06 02:55:14 UTC (rev 5935) +++ branches/1.2.x/numpy/ma/core.py 2008-10-06 21:05:03 UTC (rev 5936) @@ -57,17 +57,14 @@ 'var', 'where', 'zeros'] -import sys -import types import cPickle import operator import numpy as np -from numpy import ndarray, typecodes, amax, amin, iscomplexobj,\ - bool_, complex_, float_, int_, object_, str_ +from numpy import ndarray, amax, amin, iscomplexobj, bool_, complex_, float_,\ + int_, object_ from numpy import array as narray - import numpy.core.umath as umath import numpy.core.numerictypes as ntypes from numpy import expand_dims as n_expand_dims @@ -1237,7 +1234,7 @@ def __new__(cls, data=None, mask=nomask, dtype=None, copy=False, subok=True, ndmin=0, fill_value=None, - keep_mask=True, hard_mask=False, flag=None, shrink=True, + keep_mask=True, hard_mask=None, flag=None, shrink=True, **options): """Create a new masked array from scratch. @@ -1257,9 +1254,9 @@ copy = True # Careful, cls might not always be MaskedArray... if not isinstance(data, cls) or not subok: - _data = _data.view(cls) + _data = ndarray.view(_data, cls) else: - _data = _data.view(type(data)) + _data = ndarray.view(_data, type(data)) # Backwards compatibility w/ numpy.core.ma ....... if hasattr(data,'_mask') and not isinstance(data, ndarray): _data._mask = data._mask @@ -1341,7 +1338,10 @@ if fill_value is not None: _data._fill_value = _check_fill_value(fill_value, _data.dtype) # Process extra options .. - _data._hardmask = hard_mask + if hard_mask is None: + _data._hardmask = getattr(data, '_hardmask', False) + else: + _data._hardmask = hard_mask _data._baseclass = _baseclass return _data # @@ -1374,7 +1374,15 @@ """ # Get main attributes ......... self._update_from(obj) - self._mask = getattr(obj, '_mask', nomask) + if isinstance(obj, ndarray): + odtype = obj.dtype + if odtype.names: + _mask = getattr(obj, '_mask', make_mask_none(obj.shape, odtype)) + else: + _mask = getattr(obj, '_mask', nomask) + else: + _mask = nomask + self._mask = _mask # Finalize the mask ........... if self._mask is not nomask: self._mask.shape = self.shape @@ -1425,6 +1433,24 @@ #.... return result #............................................. + def view(self, dtype=None, type=None): + if dtype is not None: + if type is None: + args = (dtype,) + else: + args = (dtype, type) + elif type is None: + args = () + else: + args = (type,) + output = ndarray.view(self, *args) + if (getattr(output,'_mask', nomask) is not nomask): + mdtype = make_mask_descr(output.dtype) + output._mask = self._mask.view(mdtype, ndarray) + output._mask.shape = output.shape + return output + view.__doc__ = ndarray.view.__doc__ + #............................................. def astype(self, newtype): """Returns a copy of the array cast to newtype.""" newtype = np.dtype(newtype) @@ -1453,15 +1479,22 @@ # if getmask(indx) is not nomask: # msg = "Masked arrays must be filled before they can be used as indices!" # raise IndexError, msg - dout = ndarray.__getitem__(self.view(ndarray), indx) + dout = ndarray.__getitem__(ndarray.view(self,ndarray), indx) # We could directly use ndarray.__getitem__ on self... # But then we would have to modify __array_finalize__ to prevent the # mask of being reshaped if it hasn't been set up properly yet... # So it's easier to stick to the current version _mask = self._mask if not getattr(dout,'ndim', False): + # A record ................ + if isinstance(dout, np.void): + mask = _mask[indx] + if mask.view((bool,len(mask.dtype))).any(): + dout = masked_array(dout, mask=mask) + else: + return dout # Just a scalar............ - if _mask is not nomask and _mask[indx]: + elif _mask is not nomask and _mask[indx]: return masked else: # Force dout to MA ........ @@ -1701,7 +1734,7 @@ underlying data. """ - return self.view(self._baseclass) + return ndarray.view(self, self._baseclass) _data = property(fget=_get_data) data = property(fget=_get_data) @@ -1817,18 +1850,33 @@ def compress(self, condition, axis=None, out=None): - """Return a where condition is True. - If condition is a MaskedArray, missing values are considered as False. + """ + Return `a` where condition is ``True``. + If condition is a `MaskedArray`, missing values are considered as ``False``. - Returns - ------- - A MaskedArray object. + Parameters + ---------- + condition : var + Boolean 1-d array selecting which entries to return. If len(condition) + is less than the size of a along the axis, then output is truncated + to length of condition array. + axis : {None, int}, optional + Axis along which the operation must be performed. + out : {None, ndarray}, optional + Alternative output array in which to place the result. It must have + the same shape as the expected output but the type will be cast if + necessary. - Notes - ----- - Please note the difference with compressed() ! - The output of compress has a mask, the output of compressed does not. + Returns + ------- + result : MaskedArray + A :class:`MaskedArray` object. + Warnings + -------- + Please note the difference with :meth:`compressed` ! + The output of :meth:`compress` has a mask, the output of :meth:`compressed` does not. + """ # Get the basic components (_data, _mask) = (self._data, self._mask) @@ -1855,7 +1903,15 @@ res = self._data else: if m.shape == (): - if m: + if m.dtype.names: + m = m.view((bool, len(m.dtype))) + if m.any(): + r = np.array(self._data.tolist(), dtype=object) + np.putmask(r, m, f) + return str(tuple(r)) + else: + return str(self._data) + elif m: return str(f) else: return str(self._data) @@ -1892,34 +1948,56 @@ mask = %(mask)s, fill_value=%(fill)s) """ + with_mask_flx = """\ +masked_%(name)s(data = + %(data)s, + mask = + %(mask)s, + fill_value=%(fill)s, + dtype=%(dtype)s) +""" + with_mask1_flx = """\ +masked_%(name)s(data = %(data)s, + mask = %(mask)s, + fill_value=%(fill)s + dtype=%(dtype)s) +""" n = len(self.shape) name = repr(self._data).split('(')[0] - if n <= 1: - return with_mask1 % { - 'name': name, - 'data': str(self), - 'mask': str(self._mask), - 'fill': str(self.fill_value), - } - return with_mask % { - 'name': name, - 'data': str(self), - 'mask': str(self._mask), - 'fill': str(self.fill_value), - } + parameters = dict(name=name, data=str(self), mask=str(self._mask), + fill=str(self.fill_value), dtype=str(self.dtype)) + if self.dtype.names: + if n<= 1: + return with_mask1_flx % parameters + return with_mask_flx % parameters + elif n <= 1: + return with_mask1 % parameters + return with_mask % parameters #............................................ def __add__(self, other): "Add other to self, and return a new masked array." return add(self, other) # + def __radd__(self, other): + "Add other to self, and return a new masked array." + return add(self, other) + # def __sub__(self, other): "Subtract other to self, and return a new masked array." return subtract(self, other) # + def __rsub__(self, other): + "Subtract other to self, and return a new masked array." + return subtract(other, self) + # def __mul__(self, other): "Multiply other by self, and return a new masked array." return multiply(self, other) # + def __rmul__(self, other): + "Multiply other by self, and return a new masked array." + return multiply(self, other) + # def __div__(self, other): "Divide other into self, and return a new masked array." return divide(self, other) @@ -2038,9 +2116,10 @@ Returns ------- - A masked array where the mask is True where all data are - masked. If axis is None, returns either a scalar ot the - masked singleton if all values are masked. + result : MaskedArray + A masked array where the mask is True where all data are + masked. If axis is None, returns either a scalar ot the + masked singleton if all values are masked. """ m = self._mask @@ -2182,7 +2261,7 @@ Check if all of the elements of `a` are true. - Performs a logical_and over the given axis and returns the result. + Performs a :func:`logical_and` over the given axis and returns the result. Masked values are considered as True during computation. For convenience, the output array is masked where ALL the values along the current axis are masked: if the output would have been a scalar and that @@ -2344,10 +2423,8 @@ def cumsum(self, axis=None, dtype=None, out=None): - """a.cumsum(axis=None, dtype=None, out=None) - + """ Return the cumulative sum of the elements along the given axis. - The cumulative sum is calculated over the flattened array by default, otherwise over the specified axis. @@ -2358,20 +2435,24 @@ Parameters ---------- axis : {None, -1, int}, optional - Axis along which the sum is computed. The default - (`axis` = None) is to compute over the flattened array. + Axis along which the sum is computed. The default (`axis` = None) is to + compute over the flattened array. `axis` may be negative, in which case + it counts from the last to the first axis. dtype : {None, dtype}, optional - Determines the type of the returned array and of the accumulator - where the elements are summed. If dtype has the value None and - the type of a is an integer type of precision less than the default - platform integer, then the default platform integer precision is - used. Otherwise, the dtype is the same as that of a. + Type of the returned array and of the accumulator in which the + elements are summed. If `dtype` is not specified, it defaults + to the dtype of `a`, unless `a` has an integer dtype with a + precision less than that of the default platform integer. In + that case, the default platform integer is used. out : ndarray, optional Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type will be cast if necessary. - WARNING : The mask is lost if out is not a valid MaskedArray ! + Warning + ------- + The mask is lost if out is not a valid :class:`MaskedArray` ! + Returns ------- cumsum : ndarray. @@ -2380,7 +2461,8 @@ Example ------- - >>> print np.ma.array(np.arange(10), mask=[0,0,0,1,1,1,0,0,0,0]).cumsum() + >>> marr = np.ma.array(np.arange(10), mask=[0,0,0,1,1,1,0,0,0,0]) + >>> print marr.cumsum() [0 1 3 -- -- -- 9 16 24 33] @@ -2401,8 +2483,7 @@ def prod(self, axis=None, dtype=None, out=None): - """a.prod(axis=None, dtype=None, out=None) - + """ Return the product of the array elements over the given axis. Masked elements are set to 1 internally for computation. @@ -2413,8 +2494,8 @@ product is over all the array elements. dtype : {None, dtype}, optional Determines the type of the returned array and of the accumulator - where the elements are multiplied. If dtype has the value None and - the type of a is an integer type of precision less than the default + where the elements are multiplied. If ``dtype`` has the value ``None`` + and the type of a is an integer type of precision less than the default platform integer, then the default platform integer precision is used. Otherwise, the dtype is the same as that of a. out : {None, array}, optional @@ -2473,10 +2554,7 @@ def cumprod(self, axis=None, dtype=None, out=None): """ - a.cumprod(axis=None, dtype=None, out=None) - Return the cumulative product of the elements along the given axis. - The cumulative product is taken over the flattened array by default, otherwise over the specified axis. @@ -2491,21 +2569,24 @@ (`axis` = None) is to compute over the flattened array. dtype : {None, dtype}, optional Determines the type of the returned array and of the accumulator - where the elements are multiplied. If dtype has the value None and - the type of a is an integer type of precision less than the default + where the elements are multiplied. If ``dtype`` has the value ``None`` and + the type of ``a`` is an integer type of precision less than the default platform integer, then the default platform integer precision is - used. Otherwise, the dtype is the same as that of a. + used. Otherwise, the dtype is the same as that of ``a``. out : ndarray, optional Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type will be cast if necessary. - WARNING : The mask is lost if out is not a valid MaskedArray ! + Warning + ------- + The mask is lost if out is not a valid MaskedArray ! + Returns ------- - cumprod : ndarray. - A new array holding the result is returned unless out is - specified, in which case a reference to out is returned. + cumprod : ndarray + A new array holding the result is returned unless out is specified, + in which case a reference to out is returned. Notes ----- @@ -2524,43 +2605,7 @@ def mean(self, axis=None, dtype=None, out=None): - """a.mean(axis=None, dtype=None, out=None) -> mean - - Returns the average of the array elements. The average is taken over the - flattened array by default, otherwise over the specified axis. - - Parameters - ---------- - axis : integer - Axis along which the means are computed. The default is - to compute the mean of the flattened array. - dtype : type - Type to use in computing the means. For arrays of - integer type the default is float32, for arrays of float types it - is the same as the array type. - out : ndarray - Alternative output array in which to place the result. It must have - the same shape as the expected output but the type will be cast if - necessary. - - Returns - ------- - mean : The return type varies, see above. - A new array holding the result is returned unless out is specified, - in which case a reference to out is returned. - - See Also - -------- - var : variance - std : standard deviation - - Notes - ----- - The mean is the sum of the elements along the axis divided by the - number of elements. - - - """ + "" if self._mask is nomask: result = super(MaskedArray, self).mean(axis=axis, dtype=dtype) else: @@ -2576,21 +2621,22 @@ outmask.flat = getattr(result, '_mask', nomask) return out return result + mean.__doc__ = ndarray.mean.__doc__ def anom(self, axis=None, dtype=None): - """Return the anomalies (deviations from the average) along - the given axis. + """ + Return the anomalies (deviations from the average) along the given axis. - Parameters - ---------- - axis : int, optional - Axis along which to perform the operation. - If None, applies to a flattened version of the array. - dtype : {dtype}, optional - Datatype for the intermediary computation. If not - given, the current dtype is used instead. + Parameters + ---------- + axis : int, optional + Axis along which to perform the operation. + If None, applies to a flattened version of the array. + dtype : {dtype}, optional + Datatype for the intermediary computation. + If not given, the current dtype is used instead. - """ + """ m = self.mean(axis, dtype) if not axis: return (self - m) @@ -2598,50 +2644,7 @@ return (self - expand_dims(m,axis)) def var(self, axis=None, dtype=None, out=None, ddof=0): - """a.var(axis=None, dtype=None, out=None, ddof=0) -> variance - - Returns the variance of the array elements, a measure of the spread of a - distribution. The variance is computed for the flattened array by default, - otherwise over the specified axis. - - Parameters - ---------- - axis : integer - Axis along which the variance is computed. The default is to - compute the variance of the flattened array. - dtype : data-type - Type to use in computing the variance. For arrays of integer type - the default is float32, for arrays of float types it is the same as - the array type. - out : ndarray - Alternative output array in which to place the result. It must have - the same shape as the expected output but the type will be cast if - necessary. - ddof : {0, integer}, - Means Delta Degrees of Freedom. The divisor used in calculation is - N - ddof. - - Returns - ------- - variance : The return type varies, see above. - A new array holding the result is returned unless out is specified, - in which case a reference to out is returned. - - See Also - -------- - std : standard deviation - mean: average - - Notes - ----- - The variance is the average of the squared deviations from the mean, - i.e. var = mean(abs(x - x.mean())**2). The mean is computed by - dividing by N-ddof, where N is the number of elements. The argument - ddof defaults to zero; for an unbiased estimate supply ddof=1. Note - that for complex numbers the absolute value is taken before squaring, - so that the result is always real and nonnegative. - - """ + "" # Easy case: nomask, business as usual if self._mask is nomask: return self._data.var(axis=axis, dtype=dtype, out=out, ddof=ddof) @@ -2675,52 +2678,11 @@ out.__setmask__(dvar.mask) return out return dvar + var.__doc__ = np.var.__doc__ - def std(self, axis=None, dtype=None, out=None, ddof=0): - """a.std(axis=None, dtype=None, out=None, ddof=0) - Returns the standard deviation of the array elements, a measure of the - spread of a distribution. The standard deviation is computed for the - flattened array by default, otherwise over the specified axis. - - Parameters - ---------- - axis : integer - Axis along which the standard deviation is computed. The default is - to compute the standard deviation of the flattened array. - dtype : type - Type to use in computing the standard deviation. For arrays of - integer type the default is float32, for arrays of float types it - is the same as the array type. - out : ndarray - Alternative output array in which to place the result. It must have - the same shape as the expected output but the type will be cast if - necessary. - ddof : {0, integer} - Means Delta Degrees of Freedom. The divisor used in calculations - is N-ddof. - - Returns - ------- - standard deviation : The return type varies, see above. - A new array holding the result is returned unless out is specified, - in which case a reference to out is returned. - - See Also - -------- - var : variance - mean : average - - Notes - ----- - The standard deviation is the square root of the average of the squared - deviations from the mean, i.e. var = sqrt(mean(abs(x - x.mean())**2)). The - computed standard deviation is computed by dividing by the number of - elements, N-ddof. The option ddof defaults to zero, that is, a biased - estimate. Note that for complex numbers std takes the absolute value before - squaring, so that the result is always real and nonnegative. - - """ + def std(self, axis=None, dtype=None, out=None, ddof=0): + "" dvar = self.var(axis=axis,dtype=dtype,out=out, ddof=ddof) if dvar is not masked: dvar = sqrt(dvar) @@ -2728,6 +2690,7 @@ out **= 0.5 return out return dvar + std.__doc__ = np.std.__doc__ #............................................ def round(self, decimals=0, out=None): @@ -2928,8 +2891,7 @@ #............................................ def min(self, axis=None, out=None, fill_value=None): - """a.min(axis=None, out=None, fill_value=None) - + """ Return the minimum along a given axis. Parameters @@ -2938,11 +2900,11 @@ Axis along which to operate. By default, ``axis`` is None and the flattened input is used. out : array_like, optional - Alternative output array in which to place the result. Must - be of the same shape and buffer length as the expected output. + Alternative output array in which to place the result. Must be of + the same shape and buffer length as the expected output. fill_value : {var}, optional Value used to fill in the masked values. - If None, use the output of minimum_fill_value(). + If None, use the output of `minimum_fill_value`. Returns ------- @@ -2950,6 +2912,11 @@ New array holding the result. If ``out`` was specified, ``out`` is returned. + See Also + -------- + minimum_fill_value + Returns the minimum filling value for a given datatype. + """ _mask = ndarray.__getattribute__(self, '_mask') newmask = _mask.all(axis=axis) @@ -3008,6 +2975,11 @@ New array holding the result. If ``out`` was specified, ``out`` is returned. + See Also + -------- + maximum_fill_value + Returns the maximum filling value for a given datatype. + """ _mask = ndarray.__getattribute__(self, '_mask') newmask = _mask.all(axis=axis) @@ -3214,6 +3186,14 @@ return (_mareconstruct, (self.__class__, self._baseclass, (0,), 'b', ), self.__getstate__()) + # + def __deepcopy__(self, memo={}): + from copy import deepcopy + copied = MaskedArray.__new__(type(self), self, copy=True) + memo[id(self)] = copied + for (k,v) in self.__dict__.iteritems(): + copied.__dict__[k] = deepcopy(v, memo) + return copied def _mareconstruct(subtype, baseclass, baseshape, basetype,): @@ -3314,6 +3294,8 @@ mb = getmaskarray(b) m = logical_or.outer(ma, mb) result = self.ufunc.outer(filled(a), filled(b)) + if not isinstance(result, MaskedArray): + result = result.view(MaskedArray) result._mask = m return result @@ -3557,13 +3539,15 @@ # ... all of them are True, and then check for dm.any() # shrink = numpy.logical_or.reduce([getattr(a,'_shrinkmask',True) for a in arrays]) # if shrink and not dm.any(): - if not dm.any(): + if not dm.dtype.fields and not dm.any(): data._mask = nomask else: data._mask = dm.reshape(d.shape) return data def count(a, axis = None): + if isinstance(a, MaskedArray): + return a.count(axis) return masked_array(a, copy=False).count(axis) count.__doc__ = MaskedArray.count.__doc__ @@ -3649,7 +3633,8 @@ return def transpose(a, axes=None): - """Return a view of the array with dimensions permuted according to axes, + """ + Return a view of the array with dimensions permuted according to axes, as a masked array. If ``axes`` is None (default), the output view has reversed @@ -3953,7 +3938,8 @@ #---- --- Pickling --- #####-------------------------------------------------------------------------- def dump(a,F): - """Pickle the MaskedArray `a` to the file `F`. `F` can either be + """ + Pickle the MaskedArray `a` to the file `F`. `F` can either be the handle of an exiting file, or a string representing a file name. @@ -3963,15 +3949,16 @@ return cPickle.dump(a,F) def dumps(a): - """Return a string corresponding to the pickling of the - MaskedArray. + """ + Return a string corresponding to the pickling of the MaskedArray. """ return cPickle.dumps(a) def load(F): - """Wrapper around ``cPickle.load`` which accepts either a - file-like object or a filename. + """ + Wrapper around ``cPickle.load`` which accepts either a file-like object + or a filename. """ if not hasattr(F, 'readline'): Modified: branches/1.2.x/numpy/ma/extras.py =================================================================== --- branches/1.2.x/numpy/ma/extras.py 2008-10-06 02:55:14 UTC (rev 5935) +++ branches/1.2.x/numpy/ma/extras.py 2008-10-06 21:05:03 UTC (rev 5936) @@ -415,7 +415,7 @@ """ def _median1D(data): - counts = filled(count(data, axis),0) + counts = filled(count(data),0) (idx, rmd) = divmod(counts, 2) if rmd: choice = slice(idx, idx+1) Modified: branches/1.2.x/numpy/ma/mrecords.py =================================================================== --- branches/1.2.x/numpy/ma/mrecords.py 2008-10-06 02:55:14 UTC (rev 5935) +++ branches/1.2.x/numpy/ma/mrecords.py 2008-10-06 21:05:03 UTC (rev 5936) @@ -16,23 +16,21 @@ __author__ = "Pierre GF Gerard-Marchant" import sys -import types import numpy as np -from numpy import bool_, complex_, float_, int_, str_, object_, dtype, \ - chararray, ndarray, recarray, record, array as narray +from numpy import bool_, dtype, \ + ndarray, recarray, array as narray import numpy.core.numerictypes as ntypes -from numpy.core.records import find_duplicate, format_parser from numpy.core.records import fromarrays as recfromarrays, \ - fromrecords as recfromrecords + fromrecords as recfromrecords _byteorderconv = np.core.records._byteorderconv _typestr = ntypes._typestr import numpy.ma as ma from numpy.ma import MAError, MaskedArray, masked, nomask, masked_array,\ - make_mask, mask_or, getdata, getmask, getmaskarray, filled, \ - default_fill_value, masked_print_option + getdata, getmaskarray, filled + _check_fill_value = ma.core._check_fill_value import warnings @@ -153,10 +151,9 @@ return self #...................................................... def __array_finalize__(self,obj): - MaskedArray._update_from(self,obj) # Make sure we have a _fieldmask by default .. - _fieldmask = getattr(obj, '_fieldmask', None) - if _fieldmask is None: + _mask = getattr(obj, '_mask', None) + if _mask is None: objmask = getattr(obj, '_mask', nomask) _dtype = ndarray.__getattribute__(self,'dtype') if objmask is nomask: @@ -165,15 +162,15 @@ mdescr = ma.make_mask_descr(_dtype) _mask = narray([tuple([m]*len(mdescr)) for m in objmask], dtype=mdescr).view(recarray) - else: - _mask = _fieldmask # Update some of the attributes - _locdict = self.__dict__ - if _locdict['_baseclass'] == ndarray: - _locdict['_baseclass'] = recarray - _locdict.update(_mask=_mask, _fieldmask=_mask) + _dict = self.__dict__ + _dict.update(_mask=_mask, _fieldmask=_mask) + self._update_from(obj) + if _dict['_baseclass'] == ndarray: + _dict['_baseclass'] = recarray return + def _getdata(self): "Returns the data as a recarray." return ndarray.view(self,recarray) @@ -250,7 +247,6 @@ # Get the list of names ...... fielddict = ndarray.__getattribute__(self,'dtype').fields or {} # Check the attribute -##### _localdict = self.__dict__ if attr not in fielddict: return ret if newattr: # We just added this one @@ -284,8 +280,8 @@ """Returns all the fields sharing the same fieldname base. The fieldname base is either `_data` or `_mask`.""" _localdict = self.__dict__ - _mask = _localdict['_fieldmask'] - _data = self._data + _mask = ndarray.__getattribute__(self,'_mask') + _data = ndarray.view(self, _localdict['_baseclass']) # We want a field ........ if isinstance(indx, basestring): #!!!: Make sure _sharedmask is True to propagate back to _fieldmask @@ -473,7 +469,7 @@ dtype=dtype, shape=shape, formats=formats, names=names, titles=titles, aligned=aligned, byteorder=byteorder).view(mrecarray) - _array._fieldmask.flat = zip(*masklist) + _array._mask.flat = zip(*masklist) if fill_value is not None: _array.fill_value = fill_value return _array @@ -507,13 +503,17 @@ mask : {nomask, sequence}, optional. External mask to apply on the data. -*Notes*: + Notes + ----- Lists of tuples should be preferred over lists of lists for faster processing. """ # Grab the initial _fieldmask, if needed: _fieldmask = getattr(reclist, '_fieldmask', None) # Get the list of records..... - nfields = len(reclist[0]) + try: + nfields = len(reclist[0]) + except TypeError: + nfields = len(reclist[0].dtype) if isinstance(reclist, ndarray): # Make sure we don't have some hidden mask if isinstance(reclist,MaskedArray): @@ -656,7 +656,7 @@ set to 'fi', where `i` is the number of existing fields. """ _data = mrecord._data - _mask = mrecord._fieldmask + _mask = mrecord._mask if newfieldname is None or newfieldname in reserved_fields: newfieldname = 'f%i' % len(_data.dtype) newfield = ma.array(newfield) Modified: branches/1.2.x/numpy/ma/tests/test_core.py =================================================================== --- branches/1.2.x/numpy/ma/tests/test_core.py 2008-10-06 02:55:14 UTC (rev 5935) +++ branches/1.2.x/numpy/ma/tests/test_core.py 2008-10-06 21:05:03 UTC (rev 5936) @@ -60,15 +60,15 @@ x = masked_array(0, mask=False) assert_equal(str(x), '0') x = array(0, mask=1) - assert(x.filled().dtype is x._data.dtype) + self.failUnless(x.filled().dtype is x._data.dtype) def test_basic1d(self): "Test of basic array creation and properties in 1 dimension." (x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d - assert(not isMaskedArray(x)) - assert(isMaskedArray(xm)) - assert((xm-ym).filled(0).any()) + self.failUnless(not isMaskedArray(x)) + self.failUnless(isMaskedArray(xm)) + self.failUnless((xm-ym).filled(0).any()) fail_if_equal(xm.mask.astype(int_), ym.mask.astype(int_)) s = x.shape assert_equal(np.shape(xm), s) @@ -92,8 +92,8 @@ ym.shape = s xf.shape = s # - assert(not isMaskedArray(x)) - assert(isMaskedArray(xm)) + self.failUnless(not isMaskedArray(x)) + self.failUnless(isMaskedArray(xm)) assert_equal(shape(xm), s) assert_equal(xm.shape, s) assert_equal( xm.size , reduce(lambda x,y:x*y, s)) @@ -132,6 +132,15 @@ assert_array_equal(z,[1,1,0,0]) assert_array_equal(z.mask,[False,True,False,False]) + def test_concatenate_flexible(self): + "Tests the concatenation on flexible arrays." + data = masked_array(zip(np.random.rand(10), + np.arange(10)), + dtype=[('a',float),('b',int)]) + # + test = concatenate([data[:5], data[5:]]) + assert_equal_records(test, data) + def test_creation_ndmin(self): "Check the use of ndmin" x = array([1,2,3],mask=[1,0,0], ndmin=2) @@ -168,15 +177,17 @@ x.mask = nomask data = array((x,x[::-1])) assert_equal(data, [[0,1,2,3,4],[4,3,2,1,0]]) - assert(data.mask is nomask) + self.failUnless(data.mask is nomask) def test_asarray(self): (x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d xm.fill_value = -9999 + xm._hardmask = True xmm = asarray(xm) assert_equal(xmm._data, xm._data) assert_equal(xmm._mask, xm._mask) assert_equal(xmm.fill_value, xm.fill_value) + assert_equal(xmm._hardmask, xm._hardmask) def test_fix_invalid(self): "Checks fix_invalid." @@ -189,8 +200,8 @@ "Test of masked element" x = arange(6) x[1] = masked - assert(str(masked) == '--') - assert(x[1] is masked) + self.failUnless(str(masked) == '--') + self.failUnless(x[1] is masked) assert_equal(filled(x[1], 0), 0) # don't know why these should raise an exception... #self.failUnlessRaises(Exception, lambda x,y: x+y, masked, masked) @@ -204,12 +215,12 @@ x = (1,2,3,4,5) a[0] = x assert_equal(a[0], x) - assert(a[0] is x) + self.failUnless(a[0] is x) # import datetime dt = datetime.datetime.now() a[0] = dt - assert(a[0] is dt) + self.failUnless(a[0] is dt) def test_indexing(self): @@ -268,39 +279,39 @@ n = [0,0,1,0,0] m = make_mask(n) m2 = make_mask(m) - assert(m is m2) + self.failUnless(m is m2) m3 = make_mask(m, copy=1) - assert(m is not m3) + self.failUnless(m is not m3) warnings.simplefilter('ignore', DeprecationWarning) x1 = np.arange(5) y1 = array(x1, mask=m) - #assert( y1._data is x1) + #self.failUnless( y1._data is x1) assert_equal(y1._data.__array_interface__, x1.__array_interface__) - assert( allequal(x1,y1.raw_data())) - #assert( y1.mask is m) + self.failUnless( allequal(x1,y1.raw_data())) + #self.failUnless( y1.mask is m) assert_equal(y1._mask.__array_interface__, m.__array_interface__) warnings.simplefilter('default', DeprecationWarning) y1a = array(y1) - #assert( y1a.raw_data() is y1.raw_data()) - assert( y1a._data.__array_interface__ == y1._data.__array_interface__) - assert( y1a.mask is y1.mask) + #self.failUnless( y1a.raw_data() is y1.raw_data()) + self.failUnless( y1a._data.__array_interface__ == y1._data.__array_interface__) + self.failUnless( y1a.mask is y1.mask) y2 = array(x1, mask=m) - #assert( y2.raw_data() is x1) - assert (y2._data.__array_interface__ == x1.__array_interface__) - #assert( y2.mask is m) - assert (y2._mask.__array_interface__ == m.__array_interface__) - assert( y2[2] is masked) + #self.failUnless( y2.raw_data() is x1) + self.failUnless(y2._data.__array_interface__ == x1.__array_interface__) + #self.failUnless( y2.mask is m) + self.failUnless(y2._mask.__array_interface__ == m.__array_interface__) + self.failUnless( y2[2] is masked) y2[2] = 9 - assert( y2[2] is not masked) - #assert( y2.mask is not m) - assert (y2._mask.__array_interface__ != m.__array_interface__) - assert( allequal(y2.mask, 0)) + self.failUnless( y2[2] is not masked) + #self.failUnless( y2.mask is not m) + self.failUnless(y2._mask.__array_interface__ != m.__array_interface__) + self.failUnless( allequal(y2.mask, 0)) y3 = array(x1*1.0, mask=m) - assert(filled(y3).dtype is (x1*1.0).dtype) + self.failUnless(filled(y3).dtype is (x1*1.0).dtype) x4 = arange(4) x4[2] = masked @@ -330,6 +341,24 @@ assert_not_equal(y._mask.ctypes.data, x._mask.ctypes.data) + def test_deepcopy(self): + from copy import deepcopy + a = array([0,1,2], mask=[False,True,False]) + copied = deepcopy(a) + assert_equal(copied.mask, a.mask) + assert_not_equal(id(a._mask), id(copied._mask)) + # + copied[1] = 1 + assert_equal(copied.mask,[0,0,0]) + assert_equal(a.mask, [0,1,0]) + # + copied = deepcopy(a) + assert_equal(copied.mask, a.mask) + copied.mask[1] = False + assert_equal(copied.mask,[0,0,0]) + assert_equal(a.mask, [0,1,0]) + + def test_pickling(self): "Tests pickling" import cPickle @@ -345,7 +374,7 @@ a_pickled = cPickle.loads(a.dumps()) assert_equal(a_pickled._mask, a._mask) assert_equal(a_pickled, a) - assert(isinstance(a_pickled._data,np.matrix)) + self.failUnless(isinstance(a_pickled._data,np.matrix)) def test_single_element_subscript(self): @@ -372,7 +401,7 @@ a = array([1,2,3],mask=[1,0,0]) self.assertRaises(TypeError, lambda:float(a)) assert_equal(float(a[-1]), 3.) - assert(np.isnan(float(a[0]))) + self.failUnless(np.isnan(float(a[0]))) self.assertRaises(TypeError, int, a) assert_equal(int(a[-1]), 3) self.assertRaises(MAError, lambda:int(a[0])) @@ -546,11 +575,11 @@ "Tests some scalar arithmetics on MaskedArrays." # Masked singleton should remain masked no matter what xm = array(0, mask=1) - assert((1/array(0)).mask) - assert((1 + xm).mask) - assert((-xm).mask) - assert(maximum(xm, xm).mask) - assert(minimum(xm, xm).mask) + self.failUnless((1/array(0)).mask) + self.failUnless((1 + xm).mask) + self.failUnless((-xm).mask) + self.failUnless(maximum(xm, xm).mask) + self.failUnless(minimum(xm, xm).mask) def test_arithmetic_with_masked_singleton(self): "Checks that there's no collapsing to masked" @@ -604,7 +633,7 @@ def test_count_func (self): "Tests count" ott = array([0.,1.,2.,3.], mask=[1,0,0,0]) - assert( isinstance(count(ott), int)) + self.failUnless( isinstance(count(ott), int)) assert_equal(3, count(ott)) assert_equal(1, count(1)) assert_equal(0, array(1,mask=[1])) @@ -638,6 +667,23 @@ x[-1,-1] = masked assert_equal(maximum(x), 2) + def test_minimummaximum_func(self): + a = np.ones((2,2)) + aminimum = minimum(a,a) + self.failUnless(isinstance(aminimum, MaskedArray)) + assert_equal(aminimum, np.minimum(a,a)) + # + aminimum = minimum.outer(a,a) + self.failUnless(isinstance(aminimum, MaskedArray)) + assert_equal(aminimum, np.minimum.outer(a,a)) + # + amaximum = maximum(a,a) + self.failUnless(isinstance(amaximum, MaskedArray)) + assert_equal(amaximum, np.maximum(a,a)) + # + amaximum = maximum.outer(a,a) + self.failUnless(isinstance(amaximum, MaskedArray)) + assert_equal(amaximum, np.maximum.outer(a,a)) def test_minmax_funcs_with_output(self): "Tests the min/max functions with explicit outputs" @@ -651,11 +697,11 @@ # Use the np version nout = np.empty((4,), dtype=int) result = npfunc(xm,axis=0,out=nout) - assert(result is nout) + self.failUnless(result is nout) # Use the ma version nout.fill(-999) result = mafunc(xm,axis=0,out=nout) - assert(result is nout) + self.failUnless(result is nout) def test_minmax_methods(self): @@ -663,22 +709,22 @@ (_, _, _, _, _, xm, _, _, _, _) = self.d xm.shape = (xm.size,) assert_equal(xm.max(), 10) - assert(xm[0].max() is masked) - assert(xm[0].max(0) is masked) - assert(xm[0].max(-1) is masked) + self.failUnless(xm[0].max() is masked) + self.failUnless(xm[0].max(0) is masked) + self.failUnless(xm[0].max(-1) is masked) assert_equal(xm.min(), -10.) - assert(xm[0].min() is masked) - assert(xm[0].min(0) is masked) - assert(xm[0].min(-1) is masked) + self.failUnless(xm[0].min() is masked) + self.failUnless(xm[0].min(0) is masked) + self.failUnless(xm[0].min(-1) is masked) assert_equal(xm.ptp(), 20.) - assert(xm[0].ptp() is masked) - assert(xm[0].ptp(0) is masked) - assert(xm[0].ptp(-1) is masked) + self.failUnless(xm[0].ptp() is masked) + self.failUnless(xm[0].ptp(0) is masked) + self.failUnless(xm[0].ptp(-1) is masked) # x = array([1,2,3], mask=True) - assert(x.min() is masked) - assert(x.max() is masked) - assert(x.ptp() is masked) + self.failUnless(x.min() is masked) + self.failUnless(x.max() is masked) + self.failUnless(x.ptp() is masked) #........................ def test_addsumprod (self): "Tests add, sum, product." @@ -751,13 +797,13 @@ output.fill(-9999) result = npfunc(xm, axis=0,out=output) # ... the result should be the given output - assert(result is output) + self.failUnless(result is output) assert_equal(result, xmmeth(axis=0, out=output)) # output = empty(4, dtype=int) result = xmmeth(axis=0, out=output) - assert(result is output) - assert(output[0] is masked) + self.failUnless(result is output) + self.failUnless(output[0] is masked) #------------------------------------------------------------------------------ @@ -791,8 +837,8 @@ assert_equal(xs._data, [0,10,2,3,40]) #assert_equal(xh.mask.ctypes._data, m.ctypes._data) assert_equal(xs.mask, [0,0,0,1,0]) - assert(xh._hardmask) - assert(not xs._hardmask) + self.failUnless(xh._hardmask) + self.failUnless(not xs._hardmask) xh[1:4] = [10,20,30] xs[1:4] = [10,20,30] assert_equal(xh._data, [0,10,20,3,4]) @@ -885,39 +931,39 @@ ndtype = [('a',int),('b',float),('c',"|S3")] # A check on a list should return a single record fval = _check_fill_value([-999,-999.9,"???"], ndtype) - assert(isinstance(fval,ndarray)) + self.failUnless(isinstance(fval,ndarray)) assert_equal(fval.item(), [-999,-999.9,"???"]) # A check on Non should output the defaults fval = _check_fill_value(None, ndtype) - assert(isinstance(fval,ndarray)) + self.failUnless(isinstance(fval,ndarray)) assert_equal(fval.item(), [default_fill_value(0), default_fill_value(0.), default_fill_value("0")]) #.....Using a flexible type as fill_value should work fill_val = np.array((-999,-999.9,"???"),dtype=ndtype) fval = _check_fill_value(fill_val, ndtype) - assert(isinstance(fval,ndarray)) + self.failUnless(isinstance(fval,ndarray)) assert_equal(fval.item(), [-999,-999.9,"???"]) #.....Using a flexible type w/ a different type shouldn't matter fill_val = np.array((-999,-999.9,"???"), dtype=[("A",int),("B",float),("C","|S3")]) fval = _check_fill_value(fill_val, ndtype) - assert(isinstance(fval,ndarray)) + self.failUnless(isinstance(fval,ndarray)) assert_equal(fval.item(), [-999,-999.9,"???"]) #.....Using an object-array shouldn't matter either fill_value = np.array((-999,-999.9,"???"), dtype=object) fval = _check_fill_value(fill_val, ndtype) - assert(isinstance(fval,ndarray)) + self.failUnless(isinstance(fval,ndarray)) assert_equal(fval.item(), [-999,-999.9,"???"]) # fill_value = np.array((-999,-999.9,"???")) fval = _check_fill_value(fill_val, ndtype) - assert(isinstance(fval,ndarray)) + self.failUnless(isinstance(fval,ndarray)) assert_equal(fval.item(), [-999,-999.9,"???"]) #.....One-field-only flexible type should work as well ndtype = [("a",int)] fval = _check_fill_value(-999, ndtype) - assert(isinstance(fval,ndarray)) + self.failUnless(isinstance(fval,ndarray)) assert_equal(fval.item(), (-999,)) @@ -1041,8 +1087,8 @@ def test_reduce(self): "Tests reduce on MaskedArrays." a = self.d[0] - assert(not alltrue(a,axis=0)) - assert(sometrue(a,axis=0)) + self.failUnless(not alltrue(a,axis=0)) + self.failUnless(sometrue(a,axis=0)) assert_equal(sum(a[:3],axis=0), 0) assert_equal(product(a,axis=0), 0) assert_equal(add.reduce(a), pi) @@ -1055,8 +1101,8 @@ assert_equal(amask.min(), 5) assert_equal(amask.max(0), a.max(0)) assert_equal(amask.min(0), [5,6,7,8]) - assert(amask.max(1)[0].mask) - assert(amask.min(1)[0].mask) + self.failUnless(amask.max(1)[0].mask) + self.failUnless(amask.min(1)[0].mask) #------------------------------------------------------------------------------ @@ -1309,18 +1355,18 @@ store = empty(1, dtype=bool) full = array([1,2,3], mask=True) # - assert(full.all() is masked) + self.failUnless(full.all() is masked) full.all(out=store) - assert(store) - assert(store._mask, True) - assert(store is not masked) + self.failUnless(store) + self.failUnless(store._mask, True) + self.failUnless(store is not masked) # store = empty(1, dtype=bool) - assert(full.any() is masked) + self.failUnless(full.any() is masked) full.any(out=store) - assert(not store) - assert(store._mask, True) - assert(store is not masked) + self.failUnless(not store) + self.failUnless(store._mask, True) + self.failUnless(store is not masked) def test_argmax_argmin(self): @@ -1408,7 +1454,7 @@ a = array(np.matrix([1,2,3,4]), mask=[0,0,0,0]) b = a.compressed() assert_equal(b,a) - assert(isinstance(b,np.matrix)) + self.failUnless(isinstance(b,np.matrix)) a[0,0] = masked b = a.compressed() assert_equal(b, [[2,3,4]]) @@ -1436,12 +1482,12 @@ n = [0,0,0,1,1] m = make_mask(n) x = array(d, mask = m) - assert( x[3] is masked) - assert( x[4] is masked) + self.failUnless( x[3] is masked) + self.failUnless( x[4] is masked) x[[1,4]] = [10,40] -# assert( x.mask is not m) - assert( x[3] is masked) - assert( x[4] is not masked) +# self.failUnless( x.mask is not m) + self.failUnless( x[3] is masked) + self.failUnless( x[4] is not masked) assert_equal(x, [0,10,2,-1,40]) # x = masked_array(arange(10), mask=[1,0,0,0,0]*2) @@ -1561,7 +1607,7 @@ # x = [1,4,2,3] sortedx = sort(x) - assert(not isinstance(sorted, MaskedArray)) + self.failUnless(not isinstance(sorted, MaskedArray)) # x = array([0,1,-1,-2,2], mask=nomask, dtype=np.int8) sortedx = sort(x, endwith=False) @@ -1621,7 +1667,7 @@ assert_equal(data.squeeze(), [1,2,3]) assert_equal(data.squeeze()._mask, [1,1,1]) data = masked_array([[1]], mask=True) - assert(data.squeeze() is masked) + self.failUnless(data.squeeze() is masked) def test_swapaxes(self): @@ -1668,8 +1714,8 @@ x = array(np.arange(12)) x[[1,-2]] = masked xlist = x.tolist() - assert(xlist[1] is None) - assert(xlist[-2] is None) + self.failUnless(xlist[1] is None) + self.failUnless(xlist[-2] is None) # x.shape = (3,4) xlist = x.tolist() @@ -1784,12 +1830,12 @@ output.fill(-9999) result = npfunc(xm, axis=0,out=output) # ... the result should be the given output - assert(result is output) + self.failUnless(result is output) assert_equal(result, xmmeth(axis=0, out=output)) # output = empty((3,4), dtype=int) result = xmmeth(axis=0, out=output) - assert(result is output) + self.failUnless(result is output) def test_ptp(self): @@ -1844,31 +1890,31 @@ x = array(arange(10), mask=True) for methodname in ('var', 'std'): method = getattr(x,methodname) - assert(method() is masked) - assert(method(0) is masked) - assert(method(-1) is masked) + self.failUnless(method() is masked) + self.failUnless(method(0) is masked) + self.failUnless(method(-1) is masked) # Using a masked array as explicit output _ = method(out=mout) - assert(mout is not masked) + self.failUnless(mout is not masked) assert_equal(mout.mask, True) # Using a ndarray as explicit output _ = method(out=nout) - assert(np.isnan(nout)) + self.failUnless(np.isnan(nout)) # x = array(arange(10), mask=True) x[-1] = 9 for methodname in ('var', 'std'): method = getattr(x,methodname) - assert(method(ddof=1) is masked) - assert(method(0, ddof=1) is masked) - assert(method(-1, ddof=1) is masked) + self.failUnless(method(ddof=1) is masked) + self.failUnless(method(0, ddof=1) is masked) + self.failUnless(method(-1, ddof=1) is masked) # Using a masked array as explicit output _ = method(out=mout, ddof=1) - assert(mout is not masked) + self.failUnless(mout is not masked) assert_equal(mout.mask, True) # Using a ndarray as explicit output _ = method(out=nout, ddof=1) - assert(np.isnan(nout)) + self.failUnless(np.isnan(nout)) #------------------------------------------------------------------------------ @@ -1986,7 +2032,7 @@ else: raise AssertionError("Should have failed...") test = masked_equal(a,1) - assert(test.mask, [0,1,0,0,0,0,0,0,0,0]) + assert_equal(test.mask, [0,1,0,0,0,0,0,0,0,0]) def test_masked_otherfunctions(self): @@ -2032,24 +2078,24 @@ output.fill(-9999) result = np.round(xm, decimals=2,out=output) # ... the result should be the given output - assert(result is output) + self.failUnless(result is output) assert_equal(result, xm.round(decimals=2, out=output)) # output = empty((3,4), dtype=float) result = xm.round(decimals=2, out=output) - assert(result is output) + self.failUnless(result is output) def test_identity(self): a = identity(5) - assert(isinstance(a, MaskedArray)) + self.failUnless(isinstance(a, MaskedArray)) assert_equal(a, np.identity(5)) def test_power(self): x = -1.1 assert_almost_equal(power(x,2.), 1.21) - assert(power(x,masked) is masked) + self.failUnless(power(x,masked) is masked) x = array([-1.1,-1.1,1.1,1.1,0.]) b = array([0.5,2.,0.5,2.,-1.], mask=[0,0,0,0,1]) y = power(x,b) @@ -2182,7 +2228,7 @@ store = empty(4, dtype=int) chosen = choose([2, 3, 1, 0], choices, out=store) assert_equal(store, array([20, 31, 12, 3])) - assert(store is chosen) + self.failUnless(store is chosen) # Check with some masked indices + out store = empty(4, dtype=int) indices_ = array([2, 3, 1, 0], mask=[1,0,0,1]) @@ -2204,25 +2250,25 @@ # Try the default b = a.reshape((5,2)) assert_equal(b.shape, (5,2)) - assert(b.flags['C']) + self.failUnless(b.flags['C']) # Try w/ arguments as list instead of tuple b = a.reshape(5,2) assert_equal(b.shape, (5,2)) - assert(b.flags['C']) + self.failUnless(b.flags['C']) # Try w/ order b = a.reshape((5,2), order='F') assert_equal(b.shape, (5,2)) - assert(b.flags['F']) + self.failUnless(b.flags['F']) # Try w/ order b = a.reshape(5,2, order='F') assert_equal(b.shape, (5,2)) - assert(b.flags['F']) + self.failUnless(b.flags['F']) # c = np.reshape(a, (2,5)) - assert(isinstance(c, MaskedArray)) + self.failUnless(isinstance(c, MaskedArray)) assert_equal(c.shape, (2,5)) - assert(c[0,0] is masked) - assert(c.flags['C']) + self.failUnless(c[0,0] is masked) + self.failUnless(c.flags['C']) #------------------------------------------------------------------------------ @@ -2307,8 +2353,52 @@ assert_equal(getmaskarray(test), np.array([(1, 1) , (1, 1), (1, 1)], dtype=[('a', '|b1'), ('b', '|b1')])) + # + def test_view(self): + "Test view w/ flexible dtype" + iterator = zip(np.arange(10), np.random.rand(10)) + data = np.array(iterator) + a = array(iterator, dtype=[('a',float),('b',float)]) + a.mask[0] = (1,0) + controlmask = np.array([1]+19*[0], dtype=bool) + # + test = a.view(float) + assert_equal(test, data.ravel()) + assert_equal(test.mask, controlmask) + # + test = a.view((float,2)) + assert_equal(test, data) + assert_equal(test.mask, controlmask.reshape(-1,2)) + # + test = a.view([('A',float),('B',float)]) + assert_equal(test.mask.dtype.names, ('A', 'B')) + assert_equal(test['A'], a['a']) + assert_equal(test['B'], a['b']) + # + test = a.view(np.ndarray) + assert_equal(test, a._data) + # + test = a.view((float,2), np.matrix) + assert_equal(test, data) + self.failUnless(isinstance(test, np.matrix)) + # + def test_getitem(self): + ndtype = [('a',float), ('b',float)] + a = array(zip(np.random.rand(10),np.arange(10)), dtype=ndtype) + a.mask = np.array(zip([0,0,0,0,0,0,0,0,1,1], + [1,0,0,0,0,0,0,0,1,0]), + dtype=[('a',bool),('b',bool)]) + # No mask + self.failUnless(isinstance(a[1], np.void)) + # One element masked + self.failUnless(isinstance(a[0], MaskedArray)) + assert_equal_records(a[0]._data, a._data[0]) + assert_equal_records(a[0]._mask, a._mask[0]) + # All element masked + self.failUnless(isinstance(a[-2], MaskedArray)) + assert_equal_records(a[-2]._data, a._data[-2]) + assert_equal_records(a[-2]._mask, a._mask[-2]) - ############################################################################### #------------------------------------------------------------------------------ if __name__ == "__main__": Modified: branches/1.2.x/numpy/ma/tests/test_extras.py =================================================================== --- branches/1.2.x/numpy/ma/tests/test_extras.py 2008-10-06 02:55:14 UTC (rev 5935) +++ branches/1.2.x/numpy/ma/tests/test_extras.py 2008-10-06 21:05:03 UTC (rev 5936) @@ -11,7 +11,7 @@ __revision__ = "$Revision: 3473 $" __date__ = '$Date: 2007-10-29 17:18:13 +0200 (Mon, 29 Oct 2007) $' -import numpy +import numpy as np from numpy.testing import TestCase, run_module_suite from numpy.ma.testutils import * from numpy.ma.core import * @@ -26,7 +26,7 @@ assert_equal(2.0, average(ott, weights=[1., 1., 2., 1.])) result, wts = average(ott, weights=[1.,1.,2.,1.], returned=1) assert_equal(2.0, result) - assert(wts == 4.0) + self.failUnless(wts == 4.0) ott[:] = masked assert_equal(average(ott,axis=0).mask, [True]) ott = array([0.,1.,2.,3.], mask=[1,0,0,0]) @@ -104,7 +104,7 @@ m = [1,0,0,0,0] d = masked_array(b,mask=m) c = mr_[d,0,0,d] - assert(isinstance(c,MaskedArray) or isinstance(c,core.MaskedArray)) + self.failUnless(isinstance(c,MaskedArray) or isinstance(c,core.MaskedArray)) assert_array_equal(c,[1,1,1,1,1,0,0,1,1,1,1,1]) assert_array_equal(c.mask, mr_[m,0,0,m]) @@ -117,12 +117,12 @@ b_1 = masked_array(a_1,mask=m_1) b_2 = masked_array(a_2,mask=m_2) d = mr_['1',b_1,b_2] # append columns - assert(d.shape == (5,10)) + self.failUnless(d.shape == (5,10)) assert_array_equal(d[:,:5],b_1) assert_array_equal(d[:,5:],b_2) assert_array_equal(d.mask, np.r_['1',m_1,m_2]) d = mr_[b_1,b_2] - assert(d.shape == (10,5)) + self.failUnless(d.shape == (10,5)) assert_array_equal(d[:5,:],b_1) assert_array_equal(d[5:,:],b_2) assert_array_equal(d.mask, np.r_[m_1,m_2]) @@ -158,14 +158,14 @@ assert_equal(tmp[-3], slice(0,3,None)) # tmp = notmasked_contiguous(a, 0) - assert(len(tmp[-1]) == 1) - assert(tmp[-2] is None) + self.failUnless(len(tmp[-1]) == 1) + self.failUnless(tmp[-2] is None) assert_equal(tmp[-3],tmp[-1]) - assert(len(tmp[0]) == 2) + self.failUnless(len(tmp[0]) == 2) # tmp = notmasked_contiguous(a, 1) assert_equal(tmp[0][-1], slice(0,3,None)) - assert(tmp[1] is None) + self.failUnless(tmp[1] is None) assert_equal(tmp[2][-1], slice(7,7,None)) assert_equal(tmp[2][-2], slice(0,5,None)) @@ -205,12 +205,12 @@ assert_equal(mask_rowcols(x,0).mask, [[1,1,1],[1,1,1],[0,0,0]] ) assert_equal(mask_rowcols(x,1,).mask, [[1,1,0],[1,1,0],[1,1,0]] ) x = array(x._data, mask=[[1,0,0],[0,1,0],[0,0,1]]) - assert(mask_rowcols(x).all() is masked) - assert(mask_rowcols(x,0).all() is masked) - assert(mask_rowcols(x,1).all() is masked) - assert(mask_rowcols(x).mask.all()) - assert(mask_rowcols(x,0).mask.all()) - assert(mask_rowcols(x,1).mask.all()) + self.failUnless(mask_rowcols(x).all() is masked) + self.failUnless(mask_rowcols(x,0).all() is masked) + self.failUnless(mask_rowcols(x,1).all() is masked) + self.failUnless(mask_rowcols(x).mask.all()) + self.failUnless(mask_rowcols(x,0).mask.all()) + self.failUnless(mask_rowcols(x,1).mask.all()) # def test_dot(self): "Tests dot product" @@ -332,25 +332,36 @@ def test_2d(self): "Tests median w/ 2D" (n,p) = (101,30) - x = masked_array(numpy.linspace(-1.,1.,n),) + x = masked_array(np.linspace(-1.,1.,n),) x[:10] = x[-10:] = masked - z = masked_array(numpy.empty((n,p), dtype=numpy.float_)) + z = masked_array(np.empty((n,p), dtype=float)) z[:,0] = x[:] - idx = numpy.arange(len(x)) + idx = np.arange(len(x)) for i in range(1,p): - numpy.random.shuffle(idx) + np.random.shuffle(idx) z[:,i] = x[idx] assert_equal(median(z[:,0]), 0) - assert_equal(median(z), numpy.zeros((p,))) + assert_equal(median(z), 0) + assert_equal(median(z, axis=0), np.zeros(p)) + assert_equal(median(z.T, axis=1), np.zeros(p)) # + def test_2d_waxis(self): + "Tests median w/ 2D arrays and different axis." + x = masked_array(np.arange(30).reshape(10,3)) + x[:3] = x[-3:] = masked + assert_equal(median(x), 14.5) + assert_equal(median(x, axis=0), [13.5,14.5,15.5]) + assert_equal(median(x,axis=1), [0,0,0,10,13,16,19,0,0,0]) + assert_equal(median(x,axis=1).mask, [1,1,1,0,0,0,0,1,1,1]) + # def test_3d(self): "Tests median w/ 3D" - x = numpy.ma.arange(24).reshape(3,4,2) + x = np.ma.arange(24).reshape(3,4,2) x[x%3==0] = masked assert_equal(median(x,0), [[12,9],[6,15],[12,9],[18,15]]) x.shape = (4,3,2) assert_equal(median(x,0),[[99,10],[11,99],[13,14]]) - x = numpy.ma.arange(24).reshape(4,3,2) + x = np.ma.arange(24).reshape(4,3,2) x[x%5==0] = masked assert_equal(median(x,0), [[12,10],[8,9],[16,17]]) @@ -483,9 +494,9 @@ def test_polyfit(self): "Tests polyfit" # On ndarrays - x = numpy.random.rand(10) - y = numpy.random.rand(20).reshape(-1,2) - assert_almost_equal(polyfit(x,y,3),numpy.polyfit(x,y,3)) + x = np.random.rand(10) + y = np.random.rand(20).reshape(-1,2) + assert_almost_equal(polyfit(x,y,3),np.polyfit(x,y,3)) # ON 1D maskedarrays x = x.view(MaskedArray) x[0] = masked @@ -493,17 +504,17 @@ y[0,0] = y[-1,-1] = masked # (C,R,K,S,D) = polyfit(x,y[:,0],3,full=True) - (c,r,k,s,d) = numpy.polyfit(x[1:], y[1:,0].compressed(), 3, full=True) + (c,r,k,s,d) = np.polyfit(x[1:], y[1:,0].compressed(), 3, full=True) for (a,a_) in zip((C,R,K,S,D),(c,r,k,s,d)): assert_almost_equal(a, a_) # (C,R,K,S,D) = polyfit(x,y[:,-1],3,full=True) - (c,r,k,s,d) = numpy.polyfit(x[1:-1], y[1:-1,-1], 3, full=True) + (c,r,k,s,d) = np.polyfit(x[1:-1], y[1:-1,-1], 3, full=True) for (a,a_) in zip((C,R,K,S,D),(c,r,k,s,d)): assert_almost_equal(a, a_) # (C,R,K,S,D) = polyfit(x,y,3,full=True) - (c,r,k,s,d) = numpy.polyfit(x[1:-1], y[1:-1,:], 3, full=True) + (c,r,k,s,d) = np.polyfit(x[1:-1], y[1:-1,:], 3, full=True) for (a,a_) in zip((C,R,K,S,D),(c,r,k,s,d)): assert_almost_equal(a, a_) Modified: branches/1.2.x/numpy/ma/tests/test_mrecords.py =================================================================== --- branches/1.2.x/numpy/ma/tests/test_mrecords.py 2008-10-06 02:55:14 UTC (rev 5935) +++ branches/1.2.x/numpy/ma/tests/test_mrecords.py 2008-10-06 21:05:03 UTC (rev 5936) @@ -8,23 +8,19 @@ __revision__ = "$Revision: 3473 $" __date__ = '$Date: 2007-10-29 17:18:13 +0200 (Mon, 29 Oct 2007) $' -import types - import numpy as np from numpy import recarray from numpy.core.records import fromrecords as recfromrecords, \ - fromarrays as recfromarrays + fromarrays as recfromarrays import numpy.ma.testutils from numpy.ma.testutils import * import numpy.ma as ma -from numpy.ma import masked, nomask, getdata, getmaskarray +from numpy.ma import masked, nomask -import numpy.ma.mrecords -reload(numpy.ma.mrecords) -from numpy.ma.mrecords import MaskedRecords, mrecarray,\ - fromarrays, fromtextfile, fromrecords, addfield +from numpy.ma.mrecords import MaskedRecords, mrecarray, fromarrays, \ + fromtextfile, fromrecords, addfield #.............................................................................. class TestMRecords(TestCase): @@ -207,8 +203,8 @@ # def test_set_elements(self): base = self.base.copy() - mbase = base.view(mrecarray) # Set an element to mask ..................... + mbase = base.view(mrecarray).copy() mbase[-2] = masked assert_equal(mbase._fieldmask.tolist(), np.array([(0,0,0),(1,1,1),(0,0,0),(1,1,1),(1,1,1)], @@ -268,16 +264,16 @@ base = self.base.copy() mbase = base.view(mrecarray) mbase.harden_mask() - assert(mbase._hardmask) + self.failUnless(mbase._hardmask) mbase._mask = nomask assert_equal_records(mbase._mask, base._mask) mbase.soften_mask() - assert(not mbase._hardmask) + self.failUnless(not mbase._hardmask) mbase._mask = nomask # So, the mask of a field is no longer set to nomask... assert_equal_records(mbase._mask, ma.make_mask_none(base.shape,base.dtype)) - assert(ma.make_mask(mbase['b']._mask) is nomask) + self.failUnless(ma.make_mask(mbase['b']._mask) is nomask) assert_equal(mbase['a']._mask,mbase['b']._mask) # def test_pickling(self): @@ -432,7 +428,6 @@ 'strings',4,-1e-10,,,1 """ import os - from datetime import datetime import tempfile (tmp_fd,tmp_fl) = tempfile.mkstemp() os.write(tmp_fd, fcontent) @@ -440,7 +435,7 @@ mrectxt = fromtextfile(tmp_fl, delimitor=',',varnames='ABCDEFG') os.remove(tmp_fl) # - assert(isinstance(mrectxt, MaskedRecords)) + self.failUnless(isinstance(mrectxt, MaskedRecords)) assert_equal(mrectxt.F, [1,1,1,1]) assert_equal(mrectxt.E._mask, [1,1,1,1]) assert_equal(mrectxt.C, [1,2,3.e+5,-1e-10]) Modified: branches/1.2.x/numpy/ma/tests/test_subclassing.py =================================================================== --- branches/1.2.x/numpy/ma/tests/test_subclassing.py 2008-10-06 02:55:14 UTC (rev 5935) +++ branches/1.2.x/numpy/ma/tests/test_subclassing.py 2008-10-06 21:05:03 UTC (rev 5936) @@ -11,8 +11,6 @@ __date__ = '$Date: 2007-10-29 17:18:13 +0200 (Mon, 29 Oct 2007) $' import numpy as np -import numpy.core.numeric as numeric - from numpy.testing import * from numpy.ma.testutils import * from numpy.ma.core import * @@ -78,24 +76,24 @@ m = [0,0,1,0,0] xsub = SubArray(x) xmsub = masked_array(xsub, mask=m) - assert isinstance(xmsub, MaskedArray) + self.failUnless(isinstance(xmsub, MaskedArray)) assert_equal(xmsub._data, xsub) - assert isinstance(xmsub._data, SubArray) + self.failUnless(isinstance(xmsub._data, SubArray)) def test_maskedarray_subclassing(self): "Tests subclassing MaskedArray" x = np.arange(5) mx = mmatrix(x,mask=[0,1,0,0,0]) - assert isinstance(mx._data, np.matrix) + self.failUnless(isinstance(mx._data, np.matrix)) "Tests masked_unary_operation" - assert isinstance(add(mx,mx), mmatrix) - assert isinstance(add(mx,x), mmatrix) + self.failUnless(isinstance(add(mx,mx), mmatrix)) + self.failUnless(isinstance(add(mx,x), mmatrix)) assert_equal(add(mx,x), mx+x) - assert isinstance(add(mx,mx)._data, np.matrix) - assert isinstance(add.outer(mx,mx), mmatrix) + self.failUnless(isinstance(add(mx,mx)._data, np.matrix)) + self.failUnless(isinstance(add.outer(mx,mx), mmatrix)) "Tests masked_binary_operation" - assert isinstance(hypot(mx,mx), mmatrix) - assert isinstance(hypot(mx,x), mmatrix) + self.failUnless(isinstance(hypot(mx,mx), mmatrix)) + self.failUnless(isinstance(hypot(mx,x), mmatrix)) def test_attributepropagation(self): x = array(arange(5), mask=[0]+[1]*4) @@ -103,16 +101,16 @@ ym = msubarray(x) # z = (my+1) - assert isinstance(z,MaskedArray) - assert not isinstance(z, MSubArray) - assert isinstance(z._data, SubArray) + self.failUnless(isinstance(z,MaskedArray)) + self.failUnless(not isinstance(z, MSubArray)) + self.failUnless(isinstance(z._data, SubArray)) assert_equal(z._data.info, {}) # z = (ym+1) - assert isinstance(z, MaskedArray) - assert isinstance(z, MSubArray) - assert isinstance(z._data, SubArray) - assert z._data.info['added'] > 0 + self.failUnless(isinstance(z, MaskedArray)) + self.failUnless(isinstance(z, MSubArray)) + self.failUnless(isinstance(z._data, SubArray)) + self.failUnless(z._data.info['added'] > 0) # ym._set_mask([1,0,0,0,1]) assert_equal(ym._mask, [1,0,0,0,1]) @@ -121,7 +119,7 @@ # xsub = subarray(x, info={'name':'x'}) mxsub = masked_array(xsub) - assert hasattr(mxsub, 'info') + self.failUnless(hasattr(mxsub, 'info')) assert_equal(mxsub.info, xsub.info) def test_subclasspreservation(self): @@ -132,22 +130,22 @@ xsub = MSubArray(x, mask=m, info={'xsub':xinfo}) # mxsub = masked_array(xsub, subok=False) - assert not isinstance(mxsub, MSubArray) - assert isinstance(mxsub, MaskedArray) + self.failUnless(not isinstance(mxsub, MSubArray)) + self.failUnless(isinstance(mxsub, MaskedArray)) assert_equal(mxsub._mask, m) # mxsub = asarray(xsub) - assert not isinstance(mxsub, MSubArray) - assert isinstance(mxsub, MaskedArray) + self.failUnless(not isinstance(mxsub, MSubArray)) + self.failUnless(isinstance(mxsub, MaskedArray)) assert_equal(mxsub._mask, m) # mxsub = masked_array(xsub, subok=True) - assert isinstance(mxsub, MSubArray) + self.failUnless(isinstance(mxsub, MSubArray)) assert_equal(mxsub.info, xsub.info) assert_equal(mxsub._mask, xsub._mask) # mxsub = asanyarray(xsub) - assert isinstance(mxsub, MSubArray) + self.failUnless(isinstance(mxsub, MSubArray)) assert_equal(mxsub.info, xsub.info) assert_equal(mxsub._mask, m) @@ -156,24 +154,4 @@ if __name__ == '__main__': run_module_suite() - if 0: - x = array(arange(5), mask=[0]+[1]*4) - my = masked_array(subarray(x)) - ym = msubarray(x) - # - z = (my+1) - assert isinstance(z,MaskedArray) - assert not isinstance(z, MSubArray) - assert isinstance(z._data, SubArray) - assert_equal(z._data.info, {}) - # - z = (ym+1) - assert isinstance(z, MaskedArray) - assert isinstance(z, MSubArray) - assert isinstance(z._data, SubArray) - assert z._data.info['added'] > 0 - # - ym._set_mask([1,0,0,0,1]) - assert_equal(ym._mask, [1,0,0,0,1]) - ym._series._set_mask([0,0,0,0,1]) - assert_equal(ym._mask, [0,0,0,0,1]) + Modified: branches/1.2.x/numpy/ma/testutils.py =================================================================== --- branches/1.2.x/numpy/ma/testutils.py 2008-10-06 02:55:14 UTC (rev 5935) +++ branches/1.2.x/numpy/ma/testutils.py 2008-10-06 21:05:03 UTC (rev 5936) @@ -16,12 +16,10 @@ from numpy import ndarray, float_ import numpy.core.umath as umath from numpy.testing import * -from numpy.testing.utils import build_err_msg, rand import numpy.testing.utils as utils -import core -from core import mask_or, getmask, getmaskarray, masked_array, nomask, masked -from core import fix_invalid, filled, equal, less +from core import mask_or, getmask, masked_array, nomask, masked, filled, \ + equal, less #------------------------------------------------------------------------------ def approx (a, b, fill_value=True, rtol=1.e-5, atol=1.e-8): @@ -83,10 +81,12 @@ """ # Case #1: dictionary ..... if isinstance(desired, dict): - assert isinstance(actual, dict), repr(type(actual)) + if not isinstance(actual, dict): + raise AssertionError(repr(type(actual))) assert_equal(len(actual),len(desired),err_msg) for k,i in desired.items(): - assert k in actual, repr(k) + if not k in actual: + raise AssertionError("%s not in %s" % (k,actual)) assert_equal(actual[k], desired[k], 'key=%r\n%s' % (k,err_msg)) return # Case #2: lists ..... @@ -94,7 +94,8 @@ return _assert_equal_on_sequences(actual, desired, err_msg='') if not (isinstance(actual, ndarray) or isinstance(desired, ndarray)): msg = build_err_msg([actual, desired], err_msg,) - assert desired == actual, msg + if not desired == actual: + raise AssertionError(msg) return # Case #4. arrays or equivalent if ((actual is masked) and not (desired is masked)) or \ @@ -124,10 +125,12 @@ """Raises an assertion error if two items are equal. """ if isinstance(desired, dict): - assert isinstance(actual, dict), repr(type(actual)) + if not isinstance(actual, dict): + raise AssertionError(repr(type(actual))) fail_if_equal(len(actual),len(desired),err_msg) for k,i in desired.items(): - assert k in actual, repr(k) + if not k in actual: + raise AssertionError(repr(k)) fail_if_equal(actual[k], desired[k], 'key=%r\n%s' % (k,err_msg)) return if isinstance(desired, (list,tuple)) and isinstance(actual, (list,tuple)): @@ -138,7 +141,8 @@ if isinstance(actual, np.ndarray) or isinstance(desired, np.ndarray): return fail_if_array_equal(actual, desired, err_msg) msg = build_err_msg([actual, desired], err_msg) - assert desired != actual, msg + if not desired != actual: + raise AssertionError(msg) assert_not_equal = fail_if_equal @@ -151,7 +155,8 @@ err_msg=err_msg, verbose=verbose) msg = build_err_msg([actual, desired], err_msg=err_msg, verbose=verbose) - assert round(abs(desired - actual),decimal) == 0, msg + if not round(abs(desired - actual),decimal) == 0: + raise AssertionError(msg) assert_close = assert_almost_equal Modified: branches/1.2.x/numpy/ma/timer_comparison.py =================================================================== --- branches/1.2.x/numpy/ma/timer_comparison.py 2008-10-06 02:55:14 UTC (rev 5935) +++ branches/1.2.x/numpy/ma/timer_comparison.py 2008-10-06 21:05:03 UTC (rev 5936) @@ -1,17 +1,15 @@ - import timeit -import numpy -from numpy import int_, float_, bool_ -import numpy.core.fromnumeric as fromnumeric +import numpy as np +from numpy import float_ +import np.core.fromnumeric as fromnumeric -from numpy.testing.utils import build_err_msg, rand +from np.testing.utils import build_err_msg +np.seterr(all='ignore') -numpy.seterr(all='ignore') +pi = np.pi -pi = numpy.pi - class moduletester: #----------------------------------- def __init__(self, module): @@ -61,15 +59,15 @@ y = self.filled(self.masked_array(yf, mask=m), fill_value) if (x.dtype.char != "O"): x = x.astype(float_) - if isinstance(x, numpy.ndarray) and x.size > 1: - x[numpy.isnan(x)] = 0 - elif numpy.isnan(x): + if isinstance(x, np.ndarray) and x.size > 1: + x[np.isnan(x)] = 0 + elif np.isnan(x): x = 0 if (y.dtype.char != "O"): y = y.astype(float_) - if isinstance(y, numpy.ndarray) and y.size > 1: - y[numpy.isnan(y)] = 0 - elif numpy.isnan(y): + if isinstance(y, np.ndarray) and y.size > 1: + y[np.isnan(y)] = 0 + elif np.isnan(y): y = 0 try: cond = (x.shape==() or y.shape==()) or x.shape == y.shape @@ -110,23 +108,23 @@ #---------------------------------- def test_0(self): "Tests creation" - x = numpy.array([1.,1.,1.,-2., pi/2.0, 4., 5., -10., 10., 1., 2., 3.]) + x = np.array([1.,1.,1.,-2., pi/2.0, 4., 5., -10., 10., 1., 2., 3.]) m = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] xm = self.masked_array(x, mask=m) xm[0] #---------------------------------- def test_1(self): "Tests creation" - x = numpy.array([1.,1.,1.,-2., pi/2.0, 4., 5., -10., 10., 1., 2., 3.]) - y = numpy.array([5.,0.,3., 2., -1., -4., 0., -10., 10., 1., 0., 3.]) + x = np.array([1.,1.,1.,-2., pi/2.0, 4., 5., -10., 10., 1., 2., 3.]) + y = np.array([5.,0.,3., 2., -1., -4., 0., -10., 10., 1., 0., 3.]) a10 = 10. m1 = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] m2 = [0, 0, 1, 0, 0, 1, 1, 0, 0, 0 ,0, 1] xm = self.masked_array(x, mask=m1) ym = self.masked_array(y, mask=m2) - z = numpy.array([-.5, 0., .5, .8]) + z = np.array([-.5, 0., .5, .8]) zm = self.masked_array(z, mask=[0,1,0,0]) - xf = numpy.where(m1, 1.e+20, x) + xf = np.where(m1, 1.e+20, x) xm.set_fill_value(1.e+20) #..... assert((xm-ym).filled(0).any()) @@ -146,13 +144,13 @@ #---------------------------------- def test_2(self): "Tests conversions and indexing" - x1 = numpy.array([1,2,4,3]) + x1 = np.array([1,2,4,3]) x2 = self.array(x1, mask=[1,0,0,0]) x3 = self.array(x1, mask=[0,1,0,1]) x4 = self.array(x1) # test conversion to strings junk, garbage = str(x2), repr(x2) -# assert_equal(numpy.sort(x1), self.sort(x2, fill_value=0)) +# assert_equal(np.sort(x1), self.sort(x2, fill_value=0)) # tests of indexing assert type(x2[1]) is type(x1[1]) assert x1[1] == x2[1] @@ -178,12 +176,12 @@ x4[:] = self.masked_array([1,2,3,4],[0,1,1,0]) # assert self.allequal(self.getmask(x4), self.array([0,1,1,0])) # assert self.allequal(x4, self.array([1,2,3,4])) - x1 = numpy.arange(5)*1.0 + x1 = np.arange(5)*1.0 x2 = self.masked_values(x1, 3.0) # assert self.allequal(x1,x2) # assert self.allequal(self.array([0,0,0,1,0], self.MaskType), x2.mask) x1 = self.array([1,'hello',2,3],object) - x2 = numpy.array([1,'hello',2,3],object) + x2 = np.array([1,'hello',2,3],object) s1 = x1[1] s2 = x2[1] assert x1[1:1].shape == (0,) @@ -216,15 +214,15 @@ def test_4(self): "Test of take, transpose, inner, outer products" x = self.arange(24) - y = numpy.arange(24) + y = np.arange(24) x[5:6] = self.masked x = x.reshape(2,3,4) y = y.reshape(2,3,4) - assert self.allequal(numpy.transpose(y,(2,0,1)), self.transpose(x,(2,0,1))) - assert self.allequal(numpy.take(y, (2,0,1), 1), self.take(x, (2,0,1), 1)) - assert self.allequal(numpy.inner(self.filled(x,0), self.filled(y,0)), + assert self.allequal(np.transpose(y,(2,0,1)), self.transpose(x,(2,0,1))) + assert self.allequal(np.take(y, (2,0,1), 1), self.take(x, (2,0,1), 1)) + assert self.allequal(np.inner(self.filled(x,0), self.filled(y,0)), self.inner(x, y)) - assert self.allequal(numpy.outer(self.filled(x,0), self.filled(y,0)), + assert self.allequal(np.outer(self.filled(x,0), self.filled(y,0)), self.outer(x, y)) y = self.array(['abc', 1, 'def', 2, 3], object) y[2] = self.masked @@ -396,8 +394,8 @@ self.assert_array_equal(self.average(x, axis=0), 2.5) self.assert_array_equal(self.average(x, axis=0, weights=w1), 2.5) y = self.array([self.arange(6), 2.0*self.arange(6)]) - self.assert_array_equal(self.average(y, None), numpy.add.reduce(numpy.arange(6))*3./12.) - self.assert_array_equal(self.average(y, axis=0), numpy.arange(6) * 3./2.) + self.assert_array_equal(self.average(y, None), np.add.reduce(np.arange(6))*3./12.) + self.assert_array_equal(self.average(y, axis=0), np.arange(6) * 3./2.) self.assert_array_equal(self.average(y, axis=1), [self.average(x,axis=0), self.average(x,axis=0) * 2.0]) self.assert_array_equal(self.average(y, None, weights=w2), 20./6.) self.assert_array_equal(self.average(y, axis=0, weights=w2), [0.,1.,2.,3.,4.,10.]) @@ -420,7 +418,7 @@ #------------------------ def test_A(self): x = self.arange(24) - y = numpy.arange(24) + y = np.arange(24) x[5:6] = self.masked x = x.reshape(2,3,4) @@ -431,10 +429,10 @@ setup_base = "from __main__ import moduletester \n"\ "import numpy\n" \ "tester = moduletester(module)\n" -# setup_new = "import numpy.ma.core_ini as module\n"+setup_base - setup_cur = "import numpy.ma.core as module\n"+setup_base -# setup_alt = "import numpy.ma.core_alt as module\n"+setup_base -# setup_tmp = "import numpy.ma.core_tmp as module\n"+setup_base +# setup_new = "import np.ma.core_ini as module\n"+setup_base + setup_cur = "import np.ma.core as module\n"+setup_base +# setup_alt = "import np.ma.core_alt as module\n"+setup_base +# setup_tmp = "import np.ma.core_tmp as module\n"+setup_base (nrepeat, nloop) = (10, 10) @@ -445,10 +443,10 @@ cur = timeit.Timer(func, setup_cur).repeat(nrepeat, nloop*10) # alt = timeit.Timer(func, setup_alt).repeat(nrepeat, nloop*10) # tmp = timeit.Timer(func, setup_tmp).repeat(nrepeat, nloop*10) -# new = numpy.sort(new) - cur = numpy.sort(cur) -# alt = numpy.sort(alt) -# tmp = numpy.sort(tmp) +# new = np.sort(new) + cur = np.sort(cur) +# alt = np.sort(alt) +# tmp = np.sort(tmp) print "#%i" % i +50*'.' print eval("moduletester.test_%i.__doc__" % i) # print "core_ini : %.3f - %.3f" % (new[0], new[1]) From numpy-svn at scipy.org Wed Oct 8 09:33:48 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 8 Oct 2008 08:33:48 -0500 (CDT) Subject: [Numpy-svn] r5937 - trunk/numpy/core/include/numpy Message-ID: <20081008133348.84EA739C27D@scipy.org> Author: cdavid Date: 2008-10-08 08:33:34 -0500 (Wed, 08 Oct 2008) New Revision: 5937 Added: trunk/numpy/core/include/numpy/utils.h Log: Add utils.h, with macro to tag a variable as unused. Added: trunk/numpy/core/include/numpy/utils.h =================================================================== --- trunk/numpy/core/include/numpy/utils.h 2008-10-06 21:05:03 UTC (rev 5936) +++ trunk/numpy/core/include/numpy/utils.h 2008-10-08 13:33:34 UTC (rev 5937) @@ -0,0 +1,19 @@ +#ifndef __NUMPY_UTILS_HEADER__ +#define __NUMPY_UTILS_HEADER__ + +#ifndef __COMP_NPY_UNUSED + #if defined(__GNUC__) + #define __COMP_NPY_UNUSED __attribute__ ((__unused__)) + # elif defined(__ICC) + #define __COMP_NPY_UNUSED __attribute__ ((__unused__)) + #else + #define __COMP_NPY_UNUSED + #endif +#endif + +/* Use this to tag a variable as not used. It will remove unused variable + * warning on support platforms (see __COM_NPY_UNUSED) and mangle the variable + * to avoid accidental use */ +#define NPY_UNUSED(x) (__NPY_UNUSED_TAGGED ## x) __COMP_NPY_UNUSED + +#endif From numpy-svn at scipy.org Wed Oct 8 09:35:11 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 8 Oct 2008 08:35:11 -0500 (CDT) Subject: [Numpy-svn] r5938 - in trunk/numpy/core: blasdot include/numpy src Message-ID: <20081008133511.12AFF39C27D@scipy.org> Author: cdavid Date: 2008-10-08 08:34:09 -0500 (Wed, 08 Oct 2008) New Revision: 5938 Modified: trunk/numpy/core/blasdot/_dotblas.c trunk/numpy/core/include/numpy/ndarrayobject.h trunk/numpy/core/src/_sortmodule.c.src trunk/numpy/core/src/arraymethods.c trunk/numpy/core/src/arrayobject.c trunk/numpy/core/src/arraytypes.inc.src trunk/numpy/core/src/multiarraymodule.c trunk/numpy/core/src/scalarmathmodule.c.src trunk/numpy/core/src/scalartypes.inc.src trunk/numpy/core/src/ufuncobject.c trunk/numpy/core/src/umathmodule.c.src Log: Use NPY_UNUSED in numpy.core sources. Modified: trunk/numpy/core/blasdot/_dotblas.c =================================================================== --- trunk/numpy/core/blasdot/_dotblas.c 2008-10-08 13:33:34 UTC (rev 5937) +++ trunk/numpy/core/blasdot/_dotblas.c 2008-10-08 13:34:09 UTC (rev 5938) @@ -80,7 +80,7 @@ static char doc_alterdot[] = "alterdot() changes all dot functions to use blas."; static PyObject * -dotblas_alterdot(PyObject *dummy, PyObject *args) +dotblas_alterdot(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyArray_Descr *descr; @@ -115,7 +115,7 @@ static char doc_restoredot[] = "restoredot() restores dots to defaults."; static PyObject * -dotblas_restoredot(PyObject *dummy, PyObject *args) +dotblas_restoredot(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyArray_Descr *descr; @@ -203,7 +203,7 @@ "dimension of b.\nNB: The first argument is not conjugated."; static PyObject * -dotblas_matrixproduct(PyObject *dummy, PyObject *args) +dotblas_matrixproduct(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *op1, *op2; PyArrayObject *ap1 = NULL, *ap2 = NULL, *ret = NULL; @@ -798,7 +798,7 @@ "not conjugated."; static PyObject * -dotblas_innerproduct(PyObject *dummy, PyObject *args) +dotblas_innerproduct(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *op1, *op2; PyArrayObject *ap1, *ap2, *ret; @@ -1046,7 +1046,7 @@ static char doc_vdot[] = "vdot(a,b)\nReturns the dot product of a and b for scalars and vectors\nof floating point and complex types. The first argument, a, is conjugated."; -static PyObject *dotblas_vdot(PyObject *dummy, PyObject *args) { +static PyObject *dotblas_vdot(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *op1, *op2; PyArrayObject *ap1=NULL, *ap2=NULL, *ret=NULL; int l; Modified: trunk/numpy/core/include/numpy/ndarrayobject.h =================================================================== --- trunk/numpy/core/include/numpy/ndarrayobject.h 2008-10-08 13:33:34 UTC (rev 5937) +++ trunk/numpy/core/include/numpy/ndarrayobject.h 2008-10-08 13:34:09 UTC (rev 5938) @@ -23,6 +23,8 @@ #define NPY_ALLOW_THREADS 0 #endif +#include "utils.h" + /* There are several places in the code where an array of dimensions is * allocated statically. This is the size of that static allocation. * Modified: trunk/numpy/core/src/_sortmodule.c.src =================================================================== --- trunk/numpy/core/src/_sortmodule.c.src 2008-10-08 13:33:34 UTC (rev 5937) +++ trunk/numpy/core/src/_sortmodule.c.src 2008-10-08 13:34:09 UTC (rev 5938) @@ -54,7 +54,7 @@ #lessequal=STDC_LE*14,NUMC_LE*3# **/ static int - at TYPE@_quicksort(@type@ *start, intp num, void *unused) + at TYPE@_quicksort(@type@ *start, intp num, void * NPY_UNUSED(unused)) { @type@ *pl = start; @type@ *pr = start + num - 1; @@ -112,7 +112,7 @@ } static int - at TYPE@_aquicksort(@type@ *v, intp* tosort, intp num, void *unused) + at TYPE@_aquicksort(@type@ *v, intp* tosort, intp num, void *NPY_UNUSED(unused)) { @type@ vp; intp *pl, *pr, SWAP_temp; @@ -174,7 +174,7 @@ static int - at TYPE@_heapsort(@type@ *start, intp n, void *unused) + at TYPE@_heapsort(@type@ *start, intp n, void *NPY_UNUSED(unused)) { @type@ tmp, *a; intp i,j,l; @@ -220,7 +220,7 @@ } static int - at TYPE@_aheapsort(@type@ *v, intp *tosort, intp n, void *unused) + at TYPE@_aheapsort(@type@ *v, intp *tosort, intp n, void *NPY_UNUSED(unused)) { intp *a, i,j,l, tmp; /* The arrays need to be offset by one for heapsort indexing */ @@ -306,7 +306,7 @@ } static int - at TYPE@_mergesort(@type@ *start, intp num, void *unused) + at TYPE@_mergesort(@type@ *start, intp num, void *NPY_UNUSED(unused)) { @type@ *pl, *pr, *pw; @@ -365,7 +365,7 @@ } static int - at TYPE@_amergesort(@type@ *v, intp *tosort, intp num, void *unused) + at TYPE@_amergesort(@type@ *v, intp *tosort, intp num, void *NPY_UNUSED(unused)) { intp *pl, *pr, *pw; Modified: trunk/numpy/core/src/arraymethods.c =================================================================== --- trunk/numpy/core/src/arraymethods.c 2008-10-08 13:33:34 UTC (rev 5937) +++ trunk/numpy/core/src/arraymethods.c 2008-10-08 13:34:09 UTC (rev 5938) @@ -1105,7 +1105,7 @@ static PyObject * -array_reduce(PyArrayObject *self, PyObject *args) +array_reduce(PyArrayObject *self, PyObject *NPY_UNUSED(args)) { /* version number of this pickle type. Increment if we need to change the format. Be sure to handle the old versions in Modified: trunk/numpy/core/src/arrayobject.c =================================================================== --- trunk/numpy/core/src/arrayobject.c 2008-10-08 13:33:34 UTC (rev 5937) +++ trunk/numpy/core/src/arrayobject.c 2008-10-08 13:34:09 UTC (rev 5938) @@ -3710,7 +3710,7 @@ } static PyObject * -array_power(PyArrayObject *a1, PyObject *o2, PyObject *modulo) +array_power(PyArrayObject *a1, PyObject *o2, PyObject *NPY_UNUSED(modulo)) { /* modulo is ignored! */ PyObject *value; @@ -3801,7 +3801,7 @@ } static PyObject * -array_inplace_power(PyArrayObject *a1, PyObject *o2, PyObject *modulo) +array_inplace_power(PyArrayObject *a1, PyObject *o2, PyObject *NPY_UNUSED(modulo)) { /* modulo is ignored! */ PyObject *value; @@ -6871,7 +6871,7 @@ --- default sub-class behavior */ static PyObject * -array_finalize_get(PyArrayObject *self) +array_finalize_get(PyArrayObject *NPY_UNUSED(self)) { Py_INCREF(Py_None); return Py_None; @@ -6949,7 +6949,7 @@ static PyObject * -array_alloc(PyTypeObject *type, Py_ssize_t nitems) +array_alloc(PyTypeObject *type, Py_ssize_t NPY_UNUSED(nitems)) { PyObject *obj; /* nitems will always be 0 */ @@ -9960,7 +9960,7 @@ static PyObject * -iter_array(PyArrayIterObject *it, PyObject *op) +iter_array(PyArrayIterObject *it, PyObject *NPY_UNUSED(op)) { PyObject *r; @@ -10917,7 +10917,7 @@ } static PyObject * -arraymultiter_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) +arraymultiter_new(PyTypeObject *NPY_UNUSED(subtype), PyObject *args, PyObject *kwds) { int n, i; @@ -11526,7 +11526,7 @@ }; static PyObject * -arraydescr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) +arraydescr_new(PyTypeObject *NPY_UNUSED(subtype), PyObject *args, PyObject *kwds) { PyObject *odescr; PyArray_Descr *descr, *conv; @@ -11558,7 +11558,7 @@ /* return a tuple of (callable object, args, state). */ static PyObject * -arraydescr_reduce(PyArray_Descr *self, PyObject *args) +arraydescr_reduce(PyArray_Descr *self, PyObject *NPY_UNUSED(args)) { /* version number of this pickle type. Increment if we need to change the format. Be sure to handle the old versions in @@ -12557,7 +12557,7 @@ static PyObject * -arrayflags_new(PyTypeObject *self, PyObject *args, PyObject *kwds) +arrayflags_new(PyTypeObject *NPY_UNUSED(self), PyObject *args, PyObject *NPY_UNUSED(kwds)) { PyObject *arg=NULL; if (!PyArg_UnpackTuple(args, "flagsobj", 0, 1, &arg)) Modified: trunk/numpy/core/src/arraytypes.inc.src =================================================================== --- trunk/numpy/core/src/arraytypes.inc.src 2008-10-08 13:33:34 UTC (rev 5937) +++ trunk/numpy/core/src/arraytypes.inc.src 2008-10-08 13:34:09 UTC (rev 5938) @@ -668,7 +668,7 @@ */ static void @from at _to_@to@(register @fromtyp@ *ip, register @totyp@ *op, register intp n, - PyArrayObject *aip, PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop)) { while (n--) { *op++ = (@totyp@)*ip; @@ -683,7 +683,7 @@ */ static void @from at _to_BOOL(register @fromtyp@ *ip, register Bool *op, register intp n, - PyArrayObject *aip, PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop)) { while (n--) { *op++ = (Bool)(*ip++ != FALSE); @@ -697,7 +697,7 @@ */ static void @from at _to_BOOL(register @fromtyp@ *ip, register Bool *op, register intp n, - PyArrayObject *aip, PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop)) { while (n--) { *op = (Bool)(((*ip).real != FALSE) || ((*ip).imag != FALSE)); @@ -712,7 +712,7 @@ */ static void BOOL_to_ at to@(register Bool *ip, register @totyp@ *op, register intp n, - PyArrayObject *aip, PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop)) { while (n--) { *op++ = (@totyp@)(*ip++ != FALSE); @@ -729,7 +729,7 @@ */ static void @from at _to_@to@(register @fromtyp@ *ip, register @totyp@ *op, register intp n, - PyArrayObject *aip, PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop)) { while (n--) { *op++ = (@totyp@)*ip++; @@ -748,7 +748,7 @@ */ static void @from at _to_@to@(register @fromtyp@ *ip, register @totyp@ *op, register intp n, - PyArrayObject *aip, PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop)) { n <<= 1; while (n--) { @@ -766,7 +766,7 @@ */ static void @from at _to_OBJECT(@fromtyp@ *ip, PyObject **op, intp n, PyArrayObject *aip, - PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aop)) { register intp i; int skip=@skip@; @@ -777,6 +777,26 @@ } /**end repeat**/ +#define _NPY_UNUSEDBOOL NPY_UNUSED +#define _NPY_UNUSEDBYTE NPY_UNUSED +#define _NPY_UNUSEDUBYTE NPY_UNUSED +#define _NPY_UNUSEDSHORT NPY_UNUSED +#define _NPY_UNUSEDUSHORT NPY_UNUSED +#define _NPY_UNUSEDINT NPY_UNUSED +#define _NPY_UNUSEDUINT NPY_UNUSED +#define _NPY_UNUSEDLONG NPY_UNUSED +#define _NPY_UNUSEDULONG NPY_UNUSED +#define _NPY_UNUSEDLONGLONG NPY_UNUSED +#define _NPY_UNUSEDULONGLONG NPY_UNUSED +#define _NPY_UNUSEDFLOAT NPY_UNUSED +#define _NPY_UNUSEDDOUBLE NPY_UNUSED +#define _NPY_UNUSEDLONGDOUBLE NPY_UNUSED +#define _NPY_UNUSEDCFLOAT NPY_UNUSED +#define _NPY_UNUSEDCDOUBLE NPY_UNUSED +#define _NPY_UNUSEDCLONGDOUBLE NPY_UNUSED +#define _NPY_UNUSEDSTRING +#define _NPY_UNUSEDVOID +#define _NPY_UNUSEDUNICODE /**begin repeat #to=BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE,CFLOAT,CDOUBLE,CLONGDOUBLE, STRING, UNICODE, VOID# @@ -784,7 +804,7 @@ #skip= 1*17, aip->descr->elsize*3# */ static void -OBJECT_to_ at to@(PyObject **ip, @totyp@ *op, intp n, PyArrayObject *aip, +OBJECT_to_ at to@(PyObject **ip, @totyp@ *op, intp n, PyArrayObject *_NPY_UNUSED at to@(aip), PyArrayObject *aop) { register intp i; @@ -883,7 +903,7 @@ #format="hd","hu","d","u","ld","lu",LONGLONG_FMT,ULONGLONG_FMT,"f","lf","Lf"# */ static int - at fname@_scan (FILE *fp, @type@ *ip, void *ignore, PyArray_Descr *ignore2) + at fname@_scan (FILE *fp, @type@ *ip, void *NPY_UNUSED(ignore), PyArray_Descr *NPY_UNUSED(ignored)) { return fscanf(fp, "%"@format@, ip); } @@ -897,7 +917,7 @@ #format="d","u"# */ static int - at fname@_scan (FILE *fp, @type@ *ip, void *ignore, PyArray_Descr *ignore2) + at fname@_scan (FILE *fp, @type@ *ip, void *NPY_UNUSED(ignore), PyArray_Descr *NPY_UNUSED(ignore2)) { @btype@ temp; int num; @@ -908,7 +928,7 @@ /**end repeat**/ static int -BOOL_scan (FILE *fp, Bool *ip, void *ignore, PyArray_Descr *ignore2) +BOOL_scan (FILE *fp, Bool *ip, void *NPY_UNUSED(ignore), PyArray_Descr *NPY_UNUSED(ignore2)) { int temp; int num; @@ -932,7 +952,7 @@ #btype=(long,ulong)*5# */ static int - at fname@_fromstr(char *str, @type@ *ip, char **endptr, PyArray_Descr *ignore) + at fname@_fromstr(char *str, @type@ *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore)) { @btype@ result; @@ -948,7 +968,7 @@ */ #if (PY_VERSION_HEX >= 0x02040000) || defined(PyOS_ascii_strtod) static int - at fname@_fromstr(char *str, @type@ *ip, char **endptr, PyArray_Descr *ignore) + at fname@_fromstr(char *str, @type@ *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore)) { double result; @@ -980,7 +1000,7 @@ */ static void @fname at _copyswapn (void *dst, intp dstride, void *src, intp sstride, - intp n, int swap, void *arr) + intp n, int swap, void *NPY_UNUSED(arr)) { if (src != NULL) { if (sstride == sizeof(@type@) && dstride == sizeof(@type@)) { @@ -997,7 +1017,7 @@ } static void - at fname@_copyswap (void *dst, void *src, int swap, void *arr) + at fname@_copyswap (void *dst, void *src, int swap, void *NPY_UNUSED(arr)) { if (src != NULL) /* copy first if needed */ @@ -1067,7 +1087,7 @@ */ static void @fname at _copyswapn (void *dst, intp dstride, void *src, intp sstride, intp n, - int swap, void *arr) + int NPY_UNUSED(swap), void *NPY_UNUSED(arr)) { if (src != NULL) { if (sstride == sizeof(@type@) && dstride == sizeof(@type@)) { @@ -1082,7 +1102,7 @@ } static void - at fname@_copyswap (void *dst, void *src, int swap, void *arr) + at fname@_copyswap (void *dst, void *src, int NPY_UNUSED(swap), void *NPY_UNUSED(arr)) { if (src != NULL) /* copy first if needed */ memcpy(dst, src, sizeof(@type@)); @@ -1101,7 +1121,7 @@ */ static void @fname at _copyswapn (void *dst, intp dstride, void *src, intp sstride, intp n, - int swap, void *arr) + int swap, void *NPY_UNUSED(arr)) { if (src != NULL) { /* copy first if needed */ @@ -1123,7 +1143,7 @@ } static void - at fname@_copyswap (void *dst, void *src, int swap, void *arr) + at fname@_copyswap (void *dst, void *src, int swap, void *NPY_UNUSED(arr)) { if (src != NULL) /* copy first if needed */ memcpy(dst, src, sizeof(@type@)); @@ -1225,7 +1245,7 @@ #define __ALIGNED(obj, sz) ((((size_t) obj) % (sz))==0) static void OBJECT_copyswapn (PyObject **dst, intp dstride, PyObject **src, intp sstride, - register intp n, int swap, void *arr) + register intp n, int NPY_UNUSED(swap), void *NPY_UNUSED(arr)) { register intp i; if (src != NULL) { @@ -1258,7 +1278,7 @@ } static void -OBJECT_copyswap(PyObject **dst, PyObject **src, int swap, void *arr) +OBJECT_copyswap(PyObject **dst, PyObject **src, int NPY_UNUSED(swap), void *NPY_UNUSED(arr)) { if (src != NULL) { @@ -1279,7 +1299,7 @@ /* ignore swap */ static void STRING_copyswapn (char *dst, intp dstride, char *src, intp sstride, - intp n, int swap, PyArrayObject *arr) + intp n, int NPY_UNUSED(swap), PyArrayObject *arr) { if (src != NULL && arr != NULL) { int itemsize = arr->descr->elsize; @@ -1422,7 +1442,7 @@ static void -STRING_copyswap (char *dst, char *src, int swap, PyArrayObject *arr) +STRING_copyswap(char *dst, char *src, int NPY_UNUSED(swap), PyArrayObject *arr) { if (src != NULL && arr != NULL) { memcpy(dst, src, arr->descr->elsize); @@ -1633,7 +1653,7 @@ /****************** compare **********************************/ static int -BOOL_compare(Bool *ip1, Bool *ip2, PyArrayObject *ap) +BOOL_compare(Bool *ip1, Bool *ip2, PyArrayObject *NPY_UNUSED(ap)) { return (*ip1 ? (*ip2 ? 0 : 1) : (*ip2 ? -1 : 0)); } @@ -1644,7 +1664,7 @@ */ static int - at fname@_compare (@type@ *ip1, @type@ *ip2, PyArrayObject *ap) + at fname@_compare (@type@ *ip1, @type@ *ip2, PyArrayObject *NPY_UNUSED(ap)) { return *ip1 < *ip2 ? -1 : *ip1 == *ip2 ? 0 : 1; } @@ -1658,7 +1678,7 @@ */ static int - at fname@_compare (@type@ *ip1, @type@ *ip2, PyArrayObject *ap) + at fname@_compare (@type@ *ip1, @type@ *ip2, PyArrayObject *NPY_UNUSED(ap)) { if (*ip1 == *ip2) { return ip1[1]f->scanfunc(*fp, dptr, NULL, dtype); @@ -6095,7 +6095,7 @@ } static int -fromfile_skip_separator(FILE **fp, const char *sep, void *stream_data) +fromfile_skip_separator(FILE **fp, const char *sep, void *NPY_UNUSED(stream_data)) { int result = 0; const char *sep_start = sep; @@ -6307,7 +6307,7 @@ } static PyObject * -array_fromstring(PyObject *ignored, PyObject *args, PyObject *keywds) +array_fromstring(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *keywds) { char *data; Py_ssize_t nin=-1; @@ -6440,7 +6440,7 @@ } static PyObject * -array_fromfile(PyObject *ignored, PyObject *args, PyObject *keywds) +array_fromfile(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *keywds) { PyObject *file=NULL, *ret; FILE *fp; @@ -6579,7 +6579,7 @@ } static PyObject * -array_fromiter(PyObject *ignored, PyObject *args, PyObject *keywds) +array_fromiter(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *keywds) { PyObject *iter; Py_ssize_t nin=-1; @@ -6698,7 +6698,7 @@ } static PyObject * -array_frombuffer(PyObject *ignored, PyObject *args, PyObject *keywds) +array_frombuffer(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *keywds) { PyObject *obj=NULL; Py_ssize_t nin=-1, offset=0; @@ -6721,7 +6721,7 @@ } static PyObject * -array_concatenate(PyObject *dummy, PyObject *args, PyObject *kwds) +array_concatenate(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *a0; int axis=0; @@ -6734,7 +6734,7 @@ return PyArray_Concatenate(a0, axis); } -static PyObject *array_innerproduct(PyObject *dummy, PyObject *args) { +static PyObject *array_innerproduct(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *b0, *a0; if (!PyArg_ParseTuple(args, "OO", &a0, &b0)) return NULL; @@ -6742,7 +6742,7 @@ return _ARET(PyArray_InnerProduct(a0, b0)); } -static PyObject *array_matrixproduct(PyObject *dummy, PyObject *args) { +static PyObject *array_matrixproduct(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *v, *a; if (!PyArg_ParseTuple(args, "OO", &a, &v)) return NULL; @@ -6750,7 +6750,7 @@ return _ARET(PyArray_MatrixProduct(a, v)); } -static PyObject *array_fastCopyAndTranspose(PyObject *dummy, PyObject *args) { +static PyObject *array_fastCopyAndTranspose(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *a0; if (!PyArg_ParseTuple(args, "O", &a0)) return NULL; @@ -6758,7 +6758,7 @@ return _ARET(PyArray_CopyAndTranspose(a0)); } -static PyObject *array_correlate(PyObject *dummy, PyObject *args, PyObject *kwds) { +static PyObject *array_correlate(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *shape, *a0; int mode=0; static char *kwlist[] = {"a", "v", "mode", NULL}; @@ -6988,7 +6988,7 @@ } static PyObject * -array_arange(PyObject *ignored, PyObject *args, PyObject *kws) { +array_arange(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *kws) { PyObject *o_start=NULL, *o_stop=NULL, *o_step=NULL; static char *kwd[]= {"start", "stop", "step", "dtype", NULL}; PyArray_Descr *typecode=NULL; @@ -7015,7 +7015,7 @@ } static PyObject * -array__get_ndarray_c_version(PyObject *dummy, PyObject *args, PyObject *kwds) +array__get_ndarray_c_version(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { static char *kwlist[] = {NULL}; if(!PyArg_ParseTupleAndKeywords(args, kwds, "", kwlist )) return NULL; @@ -7024,7 +7024,7 @@ } static PyObject * -array__reconstruct(PyObject *dummy, PyObject *args) +array__reconstruct(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *ret; @@ -7056,7 +7056,7 @@ } static PyObject * -array_set_string_function(PyObject *dummy, PyObject *args, PyObject *kwds) +array_set_string_function(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *op=NULL; int repr=1; @@ -7078,7 +7078,7 @@ } static PyObject * -array_set_ops_function(PyObject *self, PyObject *args, PyObject *kwds) +array_set_ops_function(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args), PyObject *kwds) { PyObject *oldops=NULL; @@ -7145,7 +7145,7 @@ } static PyObject * -array_where(PyObject *ignored, PyObject *args) +array_where(PyObject *NPY_UNUSED(ignored), PyObject *args) { PyObject *obj=NULL, *x=NULL, *y=NULL; @@ -7155,7 +7155,7 @@ } static PyObject * -array_lexsort(PyObject *ignored, PyObject *args, PyObject *kwds) +array_lexsort(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *kwds) { int axis=-1; PyObject *obj; @@ -7170,7 +7170,7 @@ #undef _ARET static PyObject * -array_can_cast_safely(PyObject *dummy, PyObject *args, PyObject *kwds) +array_can_cast_safely(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyArray_Descr *d1=NULL; PyArray_Descr *d2=NULL; @@ -7201,7 +7201,7 @@ } static PyObject * -new_buffer(PyObject *dummy, PyObject *args) +new_buffer(PyObject *NPY_UNUSED(dummy), PyObject *args) { int size; @@ -7212,7 +7212,7 @@ } static PyObject * -buffer_buffer(PyObject *dummy, PyObject *args, PyObject *kwds) +buffer_buffer(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *obj; Py_ssize_t offset=0, size=Py_END_OF_BUFFER, n; @@ -7258,7 +7258,7 @@ } static PyObject * -as_buffer(PyObject *dummy, PyObject *args, PyObject *kwds) +as_buffer(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *mem; Py_ssize_t size; @@ -7315,7 +7315,7 @@ #undef _test_code static PyObject * -format_longfloat(PyObject *dummy, PyObject *args, PyObject *kwds) +format_longfloat(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *obj; unsigned int precision; @@ -7340,7 +7340,7 @@ } static PyObject * -compare_chararrays(PyObject *dummy, PyObject *args, PyObject *kwds) +compare_chararrays(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *array; PyObject *other; @@ -7441,7 +7441,7 @@ static PyObject * -test_interrupt(PyObject *self, PyObject *args) +test_interrupt(PyObject *NPY_UNUSED(self), PyObject *args) { int kind=0; int a = 0; @@ -7546,7 +7546,7 @@ Thus, we call PyType_Ready on the standard Python Types, here. */ static int -setup_scalartypes(PyObject *dict) +setup_scalartypes(PyObject *NPY_UNUSED(dict)) { initialize_numeric_types(); Modified: trunk/numpy/core/src/scalarmathmodule.c.src =================================================================== --- trunk/numpy/core/src/scalarmathmodule.c.src 2008-10-08 13:33:34 UTC (rev 5937) +++ trunk/numpy/core/src/scalarmathmodule.c.src 2008-10-08 13:34:09 UTC (rev 5938) @@ -14,6 +14,7 @@ /** numarray adapted routines.... **/ +#if SIZEOF_LONGLONG == 64 || SIZEOF_LONGLONG == 128 static int ulonglong_overflow(ulonglong a, ulonglong b) { ulonglong ah, al, bh, bl, w, x, y, z; @@ -50,6 +51,12 @@ #endif } +#else +static int ulonglong_overflow(ulonglong NPY_UNUSED(a), ulonglong NPY_UNUSED(b)) +{ + return 0; +} +#endif static int slonglong_overflow(longlong a0, longlong b0) { @@ -665,7 +672,7 @@ **/ static PyObject * - at name@_power(PyObject *a, PyObject *b, PyObject *c) + at name@_power(PyObject *a, PyObject *b, PyObject *NPY_UNUSED(c)) { PyObject *ret; @name@ arg1, arg2; @@ -1117,7 +1124,7 @@ char doc_alterpyscalars[] = ""; static PyObject * -alter_pyscalars(PyObject *dummy, PyObject *args) +alter_pyscalars(PyObject *NPY_UNUSED(dummy), PyObject *args) { int n; PyObject *obj; @@ -1152,7 +1159,7 @@ char doc_restorepyscalars[] = ""; static PyObject * -restore_pyscalars(PyObject *dummy, PyObject *args) +restore_pyscalars(PyObject *NPY_UNUSED(dummy), PyObject *args) { int n; PyObject *obj; @@ -1186,7 +1193,7 @@ char doc_usepythonmath[] = ""; static PyObject * -use_pythonmath(PyObject *dummy, PyObject *args) +use_pythonmath(PyObject *NPY_UNUSED(dummy), PyObject *args) { int n; PyObject *obj; @@ -1220,7 +1227,7 @@ char doc_usescalarmath[] = ""; static PyObject * -use_scalarmath(PyObject *dummy, PyObject *args) +use_scalarmath(PyObject *NPY_UNUSED(dummy), PyObject *args) { int n; PyObject *obj; Modified: trunk/numpy/core/src/scalartypes.inc.src =================================================================== --- trunk/numpy/core/src/scalartypes.inc.src 2008-10-08 13:33:34 UTC (rev 5937) +++ trunk/numpy/core/src/scalartypes.inc.src 2008-10-08 13:34:09 UTC (rev 5938) @@ -373,7 +373,7 @@ static PyObject * -gentype_power(PyObject *m1, PyObject *m2, PyObject *m3) +gentype_power(PyObject *m1, PyObject *m2, PyObject *NPY_UNUSED(m3)) { PyObject *arr, *ret, *arg2; char *msg="unsupported operand type(s) for ** or pow()"; @@ -770,13 +770,13 @@ } static PyObject * -gentype_ndim_get(PyObject *self) +gentype_ndim_get(PyObject *NPY_UNUSED(self)) { return PyInt_FromLong(0); } static PyObject * -gentype_flags_get(PyObject *self) +gentype_flags_get(PyObject *NPY_UNUSED(self)) { return PyArray_NewFlagsObject(NULL); } @@ -827,7 +827,7 @@ } static PyObject * -gentype_size_get(PyObject *self) +gentype_size_get(PyObject *NPY_UNUSED(self)) { return PyInt_FromLong(1); } @@ -866,13 +866,13 @@ } static PyObject * -gentype_priority_get(PyObject *self) +gentype_priority_get(PyObject *NPY_UNUSED(self)) { return PyFloat_FromDouble(NPY_SCALAR_PRIORITY); } static PyObject * -gentype_shape_get(PyObject *self) +gentype_shape_get(PyObject *NPY_UNUSED(self)) { return PyTuple_New(0); } @@ -902,7 +902,7 @@ static PyObject * -gentype_base_get(PyObject *self) +gentype_base_get(PyObject *NPY_UNUSED(self)) { Py_INCREF(Py_None); return Py_None; @@ -1110,7 +1110,7 @@ static char doc_sc_wraparray[] = "sc.__array_wrap__(obj) return scalar from array"; static PyObject * -gentype_wraparray(PyObject *scalar, PyObject *args) +gentype_wraparray(PyObject *NPY_UNUSED(scalar), PyObject *args) { PyObject *arr; @@ -1143,7 +1143,7 @@ /**end repeat**/ static PyObject * -gentype_itemset(PyObject *self, PyObject *args) +gentype_itemset(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args)) { PyErr_SetString(PyExc_ValueError, "array-scalars are immutable"); return NULL; @@ -1230,7 +1230,7 @@ } static PyObject * -gentype_setfield(PyObject *self, PyObject *args, PyObject *kwds) +gentype_setfield(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args), PyObject *NPY_UNUSED(kwds)) { PyErr_SetString(PyExc_TypeError, "Can't set fields in a non-void array scalar."); @@ -1296,7 +1296,7 @@ static PyObject * -gentype_reduce(PyObject *self, PyObject *args) +gentype_reduce(PyObject *self, PyObject *NPY_UNUSED(args)) { PyObject *ret=NULL, *obj=NULL, *mod=NULL; const char *buffer; @@ -1369,7 +1369,7 @@ /* ignores everything */ static PyObject * -gentype_setstate(PyObject *self, PyObject *args) +gentype_setstate(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args)) { Py_INCREF(Py_None); return (Py_None); @@ -1400,7 +1400,7 @@ /* setting flags cannot be done for scalars */ static PyObject * -gentype_setflags(PyObject *self, PyObject *args, PyObject *kwds) +gentype_setflags(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args), PyObject *NPY_UNUSED(kwds)) { Py_INCREF(Py_None); return Py_None; @@ -1892,8 +1892,13 @@ #work=0,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,z,z,0# #default=0*16,1*2,2# */ + +#define _NPY_UNUSED1 +#define _NPY_UNUSEDz +#define _NPY_UNUSED0 NPY_UNUSED + static PyObject * - at name@_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) + at name@_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *_NPY_UNUSED at work@(kwds)) { PyObject *obj = NULL; PyObject *robj; @@ -1999,7 +2004,7 @@ /* bool->tp_new only returns Py_True or Py_False */ static PyObject * -bool_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +bool_arrtype_new(PyTypeObject *NPY_UNUSED(type), PyObject *args, PyObject *NPY_UNUSED(kwds)) { PyObject *obj=NULL; PyObject *arr; @@ -2095,7 +2100,7 @@ }; static PyObject * -void_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +void_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *NPY_UNUSED(kwds)) { PyObject *obj, *arr; ulonglong memu=1; Modified: trunk/numpy/core/src/ufuncobject.c =================================================================== --- trunk/numpy/core/src/ufuncobject.c 2008-10-08 13:33:34 UTC (rev 5937) +++ trunk/numpy/core/src/ufuncobject.c 2008-10-08 13:34:09 UTC (rev 5938) @@ -3500,7 +3500,7 @@ } static PyObject * -ufunc_geterr(PyObject *dummy, PyObject *args) +ufunc_geterr(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *thedict; PyObject *res; @@ -3563,7 +3563,7 @@ #endif static PyObject * -ufunc_seterr(PyObject *dummy, PyObject *args) +ufunc_seterr(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *thedict; int res; @@ -3600,7 +3600,7 @@ doc_frompyfunc[] = "frompyfunc(func, nin, nout) take an arbitrary python function that takes nin objects as input and returns nout objects and return a universal function (ufunc). This ufunc always returns PyObject arrays"; static PyObject * -ufunc_frompyfunc(PyObject *dummy, PyObject *args, PyObject *kwds) { +ufunc_frompyfunc(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *NPY_UNUSED(kwds)) { /* Keywords are ignored for now */ PyObject *function, *pyname=NULL; Modified: trunk/numpy/core/src/umathmodule.c.src =================================================================== --- trunk/numpy/core/src/umathmodule.c.src 2008-10-08 13:33:34 UTC (rev 5937) +++ trunk/numpy/core/src/umathmodule.c.src 2008-10-08 13:34:09 UTC (rev 5938) @@ -554,7 +554,7 @@ **/ static void -BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { Bool in1 = *((Bool *)ip1) != 0; @@ -565,7 +565,7 @@ /**end repeat**/ static void -BOOL_logical_xor(char **args, intp *dimensions, intp *steps, void *func) +BOOL_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { Bool in1 = *((Bool *)ip1) != 0; @@ -579,7 +579,7 @@ * #OP = >, <# **/ static void -BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { Bool in1 = *((Bool *)ip1) != 0; @@ -594,7 +594,7 @@ * #OP = !=, ==# **/ static void -BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { Bool in1 = *(Bool *)ip1; @@ -659,7 +659,7 @@ } static void - at S@@TYPE at _conjugate(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _conjugate(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -668,7 +668,7 @@ } static void - at S@@TYPE at _negative(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -677,7 +677,7 @@ } static void - at S@@TYPE at _logical_not(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -686,7 +686,7 @@ } static void - at S@@TYPE at _invert(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -701,7 +701,7 @@ * #OP = +, -,*, &, |, ^, <<, >># */ static void - at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -717,7 +717,7 @@ * #OP = ==, !=, >, >=, <, <=, &&, ||# */ static void - at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -728,7 +728,7 @@ /**end repeat2**/ static void - at S@@TYPE at _logical_xor(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -742,7 +742,7 @@ * #OP = >, <# **/ static void - at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -753,7 +753,7 @@ /**end repeat2**/ static void - at S@@TYPE at _true_divide(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _true_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -769,7 +769,7 @@ } static void - at S@@TYPE at _power(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _power(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @ftype@ in1 = (@ftype@)*(@s@@type@ *)ip1; @@ -779,7 +779,7 @@ } static void - at S@@TYPE at _fmod(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _fmod(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -798,7 +798,7 @@ /**end repeat1**/ static void -U at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) +U at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const u at type@ in1 = *(u at type@ *)ip1; @@ -807,7 +807,7 @@ } static void - at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -816,7 +816,7 @@ } static void -U at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) +U at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const u at type@ in1 = *(u at type@ *)ip1; @@ -825,7 +825,7 @@ } static void - at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -834,7 +834,7 @@ } static void - at TYPE@_divide(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -853,7 +853,7 @@ } static void -U at TYPE@_divide(char **args, intp *dimensions, intp *steps, void *func) +U at TYPE@_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const u at type@ in1 = *(u at type@ *)ip1; @@ -869,7 +869,7 @@ } static void - at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -892,7 +892,7 @@ } static void -U at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) +U at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const u at type@ in1 = *(u at type@ *)ip1; @@ -930,7 +930,7 @@ * # OP = +, -, *, /# */ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -946,7 +946,7 @@ * #OP = ==, !=, <, <=, >, >=, &&, ||# */ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -957,7 +957,7 @@ /**end repeat1**/ static void - at TYPE@_logical_xor(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -967,7 +967,7 @@ } static void - at TYPE@_logical_not(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -980,7 +980,7 @@ * #func = isnan, isinf, isfinite, signbit# **/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -994,7 +994,7 @@ * #OP = >, <# **/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { /* */ BINARY_LOOP { @@ -1006,7 +1006,7 @@ /**end repeat1**/ static void - at TYPE@_floor_divide(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_floor_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1016,7 +1016,7 @@ } static void - at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1058,7 +1058,7 @@ } static void - at TYPE@_conjugate(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_conjugate(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1067,7 +1067,7 @@ } static void - at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1078,7 +1078,7 @@ } static void - at TYPE@_negative(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1087,7 +1087,7 @@ } static void - at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { /* */ UNARY_LOOP { @@ -1105,7 +1105,7 @@ } static void - at TYPE@_modf(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_modf(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP_TWO_OUT { const @type@ in1 = *(@type@ *)ip1; @@ -1115,7 +1115,7 @@ #ifdef HAVE_FREXP at C@ static void - at TYPE@_frexp(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_frexp(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP_TWO_OUT { const @type@ in1 = *(@type@ *)ip1; @@ -1126,7 +1126,7 @@ #ifdef HAVE_LDEXP at C@ static void - at TYPE@_ldexp(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ldexp(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1161,7 +1161,7 @@ * #OP = +, -# */ static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1175,7 +1175,7 @@ /**end repeat1**/ static void - at CTYPE@_multiply(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1188,7 +1188,7 @@ } static void - at CTYPE@_divide(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1202,7 +1202,7 @@ } static void - at CTYPE@_floor_divide(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_floor_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1221,7 +1221,7 @@ #OP2 = &&, ||# */ static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1238,7 +1238,7 @@ * #OP = >, >=, <, <=# */ static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1261,7 +1261,7 @@ #OP2 = &&, ||# */ static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1274,7 +1274,7 @@ /**end repeat1**/ static void - at CTYPE@_logical_xor(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1288,7 +1288,7 @@ } static void - at CTYPE@_logical_not(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1303,7 +1303,7 @@ * #OP = ||, ||, &&# **/ static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1354,7 +1354,7 @@ } static void - at CTYPE@_conjugate(char **args, intp *dimensions, intp *steps, void *func) { + at CTYPE@_conjugate(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; const @type@ in1i = ((@type@ *)ip1)[1]; @@ -1364,7 +1364,7 @@ } static void - at CTYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1374,7 +1374,7 @@ } static void - at CTYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1405,7 +1405,7 @@ * #OP = >, <# */ static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1438,7 +1438,7 @@ * #OP = EQ, NE, GT, GE, LT, LE# */ static void -OBJECT_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { +OBJECT_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { PyObject *in1 = *(PyObject **)ip1; PyObject *in2 = *(PyObject **)ip2; @@ -1447,7 +1447,7 @@ } /**end repeat**/ -OBJECT_sign(char **args, intp *dimensions, intp *steps, void *func) +OBJECT_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { PyObject *zero = PyInt_FromLong(0); UNARY_LOOP { From numpy-svn at scipy.org Wed Oct 8 09:36:07 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 8 Oct 2008 08:36:07 -0500 (CDT) Subject: [Numpy-svn] r5939 - trunk/numpy/core/src Message-ID: <20081008133607.F3E4C39C27D@scipy.org> Author: cdavid Date: 2008-10-08 08:35:27 -0500 (Wed, 08 Oct 2008) New Revision: 5939 Modified: trunk/numpy/core/src/arraymethods.c trunk/numpy/core/src/arrayobject.c trunk/numpy/core/src/multiarraymodule.c trunk/numpy/core/src/scalarmathmodule.c.src trunk/numpy/core/src/scalartypes.inc.src trunk/numpy/core/src/ufuncobject.c trunk/numpy/core/src/umathmodule.c.src Log: Fix missing initializers warnings. Modified: trunk/numpy/core/src/arraymethods.c =================================================================== --- trunk/numpy/core/src/arraymethods.c 2008-10-08 13:34:09 UTC (rev 5938) +++ trunk/numpy/core/src/arraymethods.c 2008-10-08 13:35:27 UTC (rev 5939) @@ -2021,7 +2021,7 @@ METH_VARARGS | METH_KEYWORDS, NULL}, {"view", (PyCFunction)array_view, METH_VARARGS | METH_KEYWORDS, NULL}, - {NULL, NULL} /* sentinel */ + {NULL, NULL, 0, NULL} /* sentinel */ }; #undef _ARET Modified: trunk/numpy/core/src/arrayobject.c =================================================================== --- trunk/numpy/core/src/arrayobject.c 2008-10-08 13:34:09 UTC (rev 5938) +++ trunk/numpy/core/src/arrayobject.c 2008-10-08 13:35:27 UTC (rev 5939) @@ -6880,69 +6880,69 @@ static PyGetSetDef array_getsetlist[] = { {"ndim", (getter)array_ndim_get, - NULL, NULL}, + NULL, NULL, NULL}, {"flags", (getter)array_flags_get, - NULL, NULL}, + NULL, NULL, NULL}, {"shape", (getter)array_shape_get, (setter)array_shape_set, - NULL}, + NULL, NULL}, {"strides", (getter)array_strides_get, (setter)array_strides_set, - NULL}, + NULL, NULL}, {"data", (getter)array_data_get, (setter)array_data_set, - NULL}, + NULL, NULL}, {"itemsize", (getter)array_itemsize_get, - NULL, NULL}, + NULL, NULL, NULL}, {"size", (getter)array_size_get, - NULL, NULL}, + NULL, NULL, NULL}, {"nbytes", (getter)array_nbytes_get, - NULL, NULL}, + NULL, NULL, NULL}, {"base", (getter)array_base_get, - NULL, NULL}, + NULL, NULL, NULL}, {"dtype", (getter)array_descr_get, (setter)array_descr_set, - NULL}, + NULL, NULL}, {"real", (getter)array_real_get, (setter)array_real_set, - NULL}, + NULL, NULL}, {"imag", (getter)array_imag_get, (setter)array_imag_set, - NULL}, + NULL, NULL}, {"flat", (getter)array_flat_get, (setter)array_flat_set, - NULL}, + NULL, NULL}, {"ctypes", (getter)array_ctypes_get, - NULL, NULL}, + NULL, NULL, NULL}, {"T", (getter)array_transpose_get, - NULL, NULL}, + NULL, NULL, NULL}, {"__array_interface__", (getter)array_interface_get, - NULL, NULL}, + NULL, NULL, NULL}, {"__array_struct__", (getter)array_struct_get, - NULL, NULL}, + NULL, NULL, NULL}, {"__array_priority__", (getter)array_priority_get, - NULL, NULL}, + NULL, NULL, NULL}, {"__array_finalize__", (getter)array_finalize_get, - NULL, NULL}, - {NULL, NULL, NULL, NULL}, /* Sentinel */ + NULL, NULL, NULL}, + {NULL, NULL, NULL, NULL, NULL}, /* Sentinel */ }; /****************** end of attribute get and set routines *******************/ @@ -7017,7 +7017,17 @@ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ - 0 /* tp_weaklist */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; /* The rest of this code is to build the right kind of array from a python */ @@ -10019,7 +10029,7 @@ /* to get array */ {"__array__", (PyCFunction)iter_array, 1, NULL}, {"copy", (PyCFunction)iter_copy, 1, NULL}, - {NULL, NULL} /* sentinel */ + {NULL, NULL, 0, NULL} /* sentinel */ }; static PyObject * @@ -10038,7 +10048,7 @@ static PyMemberDef iter_members[] = { {"base", T_OBJECT, offsetof(PyArrayIterObject, ao), RO, NULL}, {"index", T_INT, offsetof(PyArrayIterObject, index), RO, NULL}, - {NULL}, + {NULL, 0, 0, 0, NULL}, }; static PyObject * @@ -10062,9 +10072,8 @@ static PyGetSetDef iter_getsets[] = { {"coords", (getter)iter_coords_get, - NULL, - NULL}, - {NULL, NULL, NULL, NULL}, + NULL, NULL, NULL}, + {NULL, NULL, NULL, NULL, NULL}, }; static PyTypeObject PyArrayIter_Type = { @@ -10100,6 +10109,30 @@ iter_methods, /* tp_methods */ iter_members, /* tp_members */ iter_getsets, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; @@ -10783,8 +10816,18 @@ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ - 0 /* tp_weaklist */ + 0, /* tp_weaklist */ + 0, /* tp_del */ +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif + }; /** END of Subscript Iterator **/ @@ -11046,24 +11089,24 @@ static PyGetSetDef arraymultiter_getsetlist[] = { {"size", (getter)arraymultiter_size_get, - NULL, NULL}, + NULL, NULL, NULL}, {"index", (getter)arraymultiter_index_get, - NULL, NULL}, + NULL, NULL, NULL}, {"shape", (getter)arraymultiter_shape_get, - NULL, NULL}, + NULL, NULL, NULL}, {"iters", (getter)arraymultiter_iters_get, - NULL, NULL}, - {NULL, NULL, NULL, NULL}, + NULL, NULL, NULL}, + {NULL, NULL, NULL, NULL, NULL}, }; static PyMemberDef arraymultiter_members[] = { {"numiter", T_INT, offsetof(PyArrayMultiIterObject, numiter), RO, NULL}, {"nd", T_INT, offsetof(PyArrayMultiIterObject, nd), RO, NULL}, - {NULL}, + {NULL, 0, 0, 0, NULL}, }; static PyObject * @@ -11078,7 +11121,7 @@ static PyMethodDef arraymultiter_methods[] = { {"reset", (PyCFunction) arraymultiter_reset, METH_VARARGS, NULL}, - {NULL, NULL}, + {NULL, NULL, 0, NULL}, }; static PyTypeObject PyArrayMultiIter_Type = { @@ -11128,7 +11171,17 @@ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ - 0 /* tp_weaklist */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; /*NUMPY_API*/ @@ -11226,7 +11279,7 @@ {"itemsize", T_INT, offsetof(PyArray_Descr, elsize), RO, NULL}, {"alignment", T_INT, offsetof(PyArray_Descr, alignment), RO, NULL}, {"flags", T_UBYTE, offsetof(PyArray_Descr, hasobject), RO, NULL}, - {NULL}, + {NULL, 0, 0, 0, NULL}, }; static PyObject * @@ -11490,39 +11543,39 @@ static PyGetSetDef arraydescr_getsets[] = { {"subdtype", (getter)arraydescr_subdescr_get, - NULL, NULL}, + NULL, NULL, NULL}, {"descr", (getter)arraydescr_protocol_descr_get, - NULL, NULL}, + NULL, NULL, NULL}, {"str", (getter)arraydescr_protocol_typestr_get, - NULL, NULL}, + NULL, NULL, NULL}, {"name", (getter)arraydescr_typename_get, - NULL, NULL}, + NULL, NULL, NULL}, {"base", (getter)arraydescr_base_get, - NULL, NULL}, + NULL, NULL, NULL}, {"shape", (getter)arraydescr_shape_get, - NULL, NULL}, + NULL, NULL, NULL}, {"isbuiltin", (getter)arraydescr_isbuiltin_get, - NULL, NULL}, + NULL, NULL, NULL}, {"isnative", (getter)arraydescr_isnative_get, - NULL, NULL}, + NULL, NULL, NULL}, {"fields", (getter)arraydescr_fields_get, - NULL, NULL}, + NULL, NULL, NULL}, {"names", (getter)arraydescr_names_get, (setter)arraydescr_names_set, - NULL}, + NULL, NULL}, {"hasobject", (getter)arraydescr_hasobject_get, - NULL, NULL}, - {NULL, NULL, NULL, NULL}, + NULL, NULL, NULL}, + {NULL, NULL, NULL, NULL, NULL}, }; static PyObject * @@ -11896,7 +11949,7 @@ NULL}, {"newbyteorder", (PyCFunction)arraydescr_newbyteorder, METH_VARARGS, NULL}, - {NULL, NULL} /* sentinel */ + {NULL, NULL, 0, NULL} /* sentinel */ }; static PyObject * @@ -12130,6 +12183,12 @@ descr_length, (binaryfunc)NULL, descr_repeat, + NULL, NULL, + NULL, /* sq_ass_item */ + NULL, /* ssizessizeobjargproc sq_ass_slice */ + 0, /* sq_contains */ + 0, /* sq_inplace_concat */ + 0, /* sq_inplace_repeat */ }; static PyMappingMethods descr_as_mapping = { @@ -12188,7 +12247,17 @@ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ - 0 /* tp_weaklist */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; @@ -12350,60 +12419,60 @@ {"contiguous", (getter)arrayflags_contiguous_get, NULL, - ""}, + "", NULL}, {"c_contiguous", (getter)arrayflags_contiguous_get, NULL, - ""}, + "", NULL}, {"f_contiguous", (getter)arrayflags_fortran_get, NULL, - ""}, + "", NULL}, {"fortran", (getter)arrayflags_fortran_get, NULL, - ""}, + "", NULL}, {"updateifcopy", (getter)arrayflags_updateifcopy_get, (setter)arrayflags_updateifcopy_set, - ""}, + "", NULL}, {"owndata", (getter)arrayflags_owndata_get, NULL, - ""}, + "", NULL}, {"aligned", (getter)arrayflags_aligned_get, (setter)arrayflags_aligned_set, - ""}, + "", NULL}, {"writeable", (getter)arrayflags_writeable_get, (setter)arrayflags_writeable_set, - ""}, + "", NULL}, {"fnc", (getter)arrayflags_fnc_get, NULL, - ""}, + "", NULL}, {"forc", (getter)arrayflags_forc_get, NULL, - ""}, + "", NULL}, {"behaved", (getter)arrayflags_behaved_get, NULL, - ""}, + "", NULL}, {"carray", (getter)arrayflags_carray_get, NULL, - ""}, + "", NULL}, {"farray", (getter)arrayflags_farray_get, NULL, - ""}, + "", NULL}, {"num", (getter)arrayflags_num_get, NULL, - ""}, - {NULL, NULL, NULL, NULL}, + "", NULL}, + {NULL, NULL, NULL, NULL, NULL}, }; static PyObject * @@ -12618,5 +12687,15 @@ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ - 0 /* tp_weaklist */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; Modified: trunk/numpy/core/src/multiarraymodule.c =================================================================== --- trunk/numpy/core/src/multiarraymodule.c 2008-10-08 13:34:09 UTC (rev 5938) +++ trunk/numpy/core/src/multiarraymodule.c 2008-10-08 13:35:27 UTC (rev 5939) @@ -7531,7 +7531,7 @@ METH_VARARGS | METH_KEYWORDS, NULL}, {"test_interrupt", (PyCFunction)test_interrupt, METH_VARARGS, NULL}, - {NULL, NULL, 0} /* sentinel */ + {NULL, NULL, 0, NULL} /* sentinel */ }; #include "__multiarray_api.c" Modified: trunk/numpy/core/src/scalarmathmodule.c.src =================================================================== --- trunk/numpy/core/src/scalarmathmodule.c.src 2008-10-08 13:34:09 UTC (rev 5938) +++ trunk/numpy/core/src/scalarmathmodule.c.src 2008-10-08 13:35:27 UTC (rev 5939) @@ -1268,7 +1268,7 @@ METH_VARARGS, doc_usepythonmath}, {"use_scalarmath", (PyCFunction) use_scalarmath, METH_VARARGS, doc_usescalarmath}, - {NULL, NULL, 0} + {NULL, NULL, 0, NULL} }; PyMODINIT_FUNC initscalarmath(void) { Modified: trunk/numpy/core/src/scalartypes.inc.src =================================================================== --- trunk/numpy/core/src/scalartypes.inc.src 2008-10-08 13:34:09 UTC (rev 5938) +++ trunk/numpy/core/src/scalartypes.inc.src 2008-10-08 13:35:27 UTC (rev 5939) @@ -24,6 +24,59 @@ 0, /*ob_size*/ "numpy. at name@", /*tp_name*/ sizeof(PyObject), /*tp_basicsize*/ + 0, /* tp_itemsize */ + /* methods */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* 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 */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; /**end repeat**/ @@ -1019,72 +1072,89 @@ {"ndim", (getter)gentype_ndim_get, (setter) 0, - "number of array dimensions"}, + "number of array dimensions", + NULL}, {"flags", (getter)gentype_flags_get, (setter)0, - "integer value of flags"}, + "integer value of flags", + NULL}, {"shape", (getter)gentype_shape_get, (setter)0, - "tuple of array dimensions"}, + "tuple of array dimensions", + NULL}, {"strides", (getter)gentype_shape_get, (setter) 0, - "tuple of bytes steps in each dimension"}, + "tuple of bytes steps in each dimension", + NULL}, {"data", (getter)gentype_data_get, (setter) 0, - "pointer to start of data"}, + "pointer to start of data", + NULL}, {"itemsize", (getter)gentype_itemsize_get, (setter)0, - "length of one element in bytes"}, + "length of one element in bytes", + NULL}, {"size", (getter)gentype_size_get, (setter)0, - "number of elements in the gentype"}, + "number of elements in the gentype", + NULL}, {"nbytes", (getter)gentype_itemsize_get, (setter)0, - "length of item in bytes"}, + "length of item in bytes", + NULL}, {"base", (getter)gentype_base_get, (setter)0, - "base object"}, + "base object", + NULL}, {"dtype", (getter)gentype_typedescr_get, NULL, - "get array data-descriptor"}, + "get array data-descriptor", + NULL}, {"real", (getter)gentype_real_get, (setter)0, - "real part of scalar"}, + "real part of scalar", + NULL}, {"imag", (getter)gentype_imag_get, (setter)0, - "imaginary part of scalar"}, + "imaginary part of scalar", + NULL}, {"flat", (getter)gentype_flat_get, (setter)0, - "a 1-d view of scalar"}, + "a 1-d view of scalar", + NULL}, {"T", (getter)gentype_transpose_get, (setter)0, - "transpose"}, + "transpose", + NULL}, {"__array_interface__", (getter)gentype_interface_get, NULL, - "Array protocol: Python side"}, + "Array protocol: Python side", + NULL}, {"__array_struct__", (getter)gentype_struct_get, NULL, - "Array protocol: struct"}, + "Array protocol: struct", + NULL}, {"__array_priority__", (getter)gentype_priority_get, NULL, - "Array priority."}, - {NULL, NULL, NULL, NULL} /* Sentinel */ + "Array priority.", + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; @@ -1574,7 +1644,7 @@ {"newbyteorder", (PyCFunction)gentype_newbyteorder, METH_VARARGS, NULL}, - {NULL, NULL} /* sentinel */ + {NULL, NULL, 0, NULL} /* sentinel */ }; @@ -1582,12 +1652,14 @@ {"flags", (getter)voidtype_flags_get, (setter)0, - "integer value of flags"}, + "integer value of flags", + NULL}, {"dtype", (getter)voidtype_dtypedescr_get, (setter)0, - "dtype object"}, - {NULL, NULL} + "dtype object", + NULL}, + {NULL, NULL, NULL, NULL, NULL} }; static PyMethodDef voidtype_methods[] = { @@ -1597,7 +1669,7 @@ {"setfield", (PyCFunction)voidtype_setfield, METH_VARARGS | METH_KEYWORDS, NULL}, - {NULL, NULL} + {NULL, NULL, 0, NULL} }; /************* As_mapping functions for void array scalar ************/ @@ -1757,15 +1829,19 @@ 0, /*sq_repeat*/ (ssizeargfunc)voidtype_item, /*sq_item*/ 0, /*sq_slice*/ - (ssizeobjargproc)voidtype_ass_item /*sq_ass_item*/ + (ssizeobjargproc)voidtype_ass_item, /*sq_ass_item*/ #else (inquiry)voidtype_length, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ (intargfunc)voidtype_item, /*sq_item*/ 0, /*sq_slice*/ - (intobjargproc)voidtype_ass_item /*sq_ass_item*/ + (intobjargproc)voidtype_ass_item, /*sq_ass_item*/ #endif + 0, /* ssq_ass_slice */ + 0, /* sq_contains */ + 0, /* sq_inplace_concat */ + 0, /* sq_inplace_repeat */ }; @@ -1844,6 +1920,59 @@ 0, /*ob_size*/ "numpy.generic", /*tp_name*/ sizeof(PyObject), /*tp_basicsize*/ + 0, /* tp_itemsize */ + /* methods */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* 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 */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; static void @@ -2097,6 +2226,32 @@ (binaryfunc)bool_arrtype_and, /* nb_and */ (binaryfunc)bool_arrtype_xor, /* nb_xor */ (binaryfunc)bool_arrtype_or, /* nb_or */ + 0, /* nb_coerce */ + 0, /* nb_int */ + 0, /* nb_long */ + 0, /* nb_float */ + 0, /* nb_oct */ + 0, /* nb_hex */ + /* Added in release 2.0 */ + 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 */ + /* Added in release 2.2 */ + /* The following require the Py_TPFLAGS_HAVE_CLASS flag */ + 0, /* nb_floor_divide */ + 0, /* nb_true_divide */ + 0, /* nb_inplace_floor_divide */ + 0, /* nb_inplace_true_divide */ + /* Added in release 2.5 */ + 0, /* nb_index */ }; static PyObject * @@ -2494,6 +2649,40 @@ (setattrofunc)object_arrtype_setattro, /* tp_setattro */ &object_arrtype_as_buffer, /* tp_as_buffer */ 0, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* 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 */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; @@ -2554,6 +2743,57 @@ 0, /*ob_size*/ "numpy. at name@@ex@", /*tp_name*/ sizeof(Py at NAME@ScalarObject), /*tp_basicsize*/ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* 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 */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; /**end repeat**/ @@ -2584,6 +2824,57 @@ 0, /*ob_size*/ "numpy. at name@" _THIS_SIZE, /*tp_name*/ sizeof(Py at NAME@ScalarObject), /*tp_basicsize*/ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* 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 */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; #undef _THIS_SIZE @@ -2647,6 +2938,39 @@ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ "Composed of two " _THIS_SIZE2 " bit floats", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* 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 */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; #undef _THIS_SIZE1 #undef _THIS_SIZE2 Modified: trunk/numpy/core/src/ufuncobject.c =================================================================== --- trunk/numpy/core/src/ufuncobject.c 2008-10-08 13:34:09 UTC (rev 5938) +++ trunk/numpy/core/src/ufuncobject.c 2008-10-08 13:35:27 UTC (rev 5939) @@ -4034,13 +4034,13 @@ static struct PyMethodDef ufunc_methods[] = { - {"reduce", (PyCFunction)ufunc_reduce, METH_VARARGS | METH_KEYWORDS }, + {"reduce", (PyCFunction)ufunc_reduce, METH_VARARGS | METH_KEYWORDS, NULL }, {"accumulate", (PyCFunction)ufunc_accumulate, - METH_VARARGS | METH_KEYWORDS }, + METH_VARARGS | METH_KEYWORDS, NULL }, {"reduceat", (PyCFunction)ufunc_reduceat, - METH_VARARGS | METH_KEYWORDS }, - {"outer", (PyCFunction)ufunc_outer, METH_VARARGS | METH_KEYWORDS }, - {NULL, NULL} /* sentinel */ + METH_VARARGS | METH_KEYWORDS, NULL }, + {"outer", (PyCFunction)ufunc_outer, METH_VARARGS | METH_KEYWORDS, NULL}, + {NULL, NULL, 0, NULL} /* sentinel */ }; @@ -4193,15 +4193,15 @@ /* static char *Ufunctype__doc__ = NULL; */ static PyGetSetDef ufunc_getset[] = { - {"__doc__", (getter)ufunc_get_doc, NULL, "documentation string"}, - {"nin", (getter)ufunc_get_nin, NULL, "number of inputs"}, - {"nout", (getter)ufunc_get_nout, NULL, "number of outputs"}, - {"nargs", (getter)ufunc_get_nargs, NULL, "number of arguments"}, - {"ntypes", (getter)ufunc_get_ntypes, NULL, "number of types"}, - {"types", (getter)ufunc_get_types, NULL, "return a list with types grouped input->output"}, - {"__name__", (getter)ufunc_get_name, NULL, "function name"}, - {"identity", (getter)ufunc_get_identity, NULL, "identity value"}, - {NULL, NULL, NULL, NULL}, /* Sentinel */ + {"__doc__", (getter)ufunc_get_doc, NULL, "documentation string", NULL}, + {"nin", (getter)ufunc_get_nin, NULL, "number of inputs", NULL}, + {"nout", (getter)ufunc_get_nout, NULL, "number of outputs", NULL}, + {"nargs", (getter)ufunc_get_nargs, NULL, "number of arguments", NULL}, + {"ntypes", (getter)ufunc_get_ntypes, NULL, "number of types", NULL}, + {"types", (getter)ufunc_get_types, NULL, "return a list with types grouped input->output", NULL}, + {"__name__", (getter)ufunc_get_name, NULL, "function name", NULL}, + {"identity", (getter)ufunc_get_identity, NULL, "identity value", NULL}, + {NULL, NULL, NULL, NULL, NULL}, /* Sentinel */ }; static PyTypeObject PyUFunc_Type = { @@ -4237,6 +4237,31 @@ ufunc_methods, /* tp_methods */ 0, /* tp_members */ ufunc_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; /* End of code for ufunc objects */ Modified: trunk/numpy/core/src/umathmodule.c.src =================================================================== --- trunk/numpy/core/src/umathmodule.c.src 2008-10-08 13:34:09 UTC (rev 5938) +++ trunk/numpy/core/src/umathmodule.c.src 2008-10-08 13:35:27 UTC (rev 5939) @@ -1586,7 +1586,7 @@ METH_VARARGS, NULL}, {"geterrobj", (PyCFunction) ufunc_geterr, METH_VARARGS, NULL}, - {NULL, NULL, 0} /* sentinel */ + {NULL, NULL, 0, NULL} /* sentinel */ }; PyMODINIT_FUNC initumath(void) { From numpy-svn at scipy.org Wed Oct 8 09:36:49 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 8 Oct 2008 08:36:49 -0500 (CDT) Subject: [Numpy-svn] r5940 - trunk/numpy/core/src Message-ID: <20081008133649.B295E39C27D@scipy.org> Author: cdavid Date: 2008-10-08 08:36:29 -0500 (Wed, 08 Oct 2008) New Revision: 5940 Modified: trunk/numpy/core/src/multiarraymodule.c trunk/numpy/core/src/scalartypes.inc.src trunk/numpy/core/src/umathmodule.c.src Log: More unused warning handled. Modified: trunk/numpy/core/src/multiarraymodule.c =================================================================== --- trunk/numpy/core/src/multiarraymodule.c 2008-10-08 13:35:27 UTC (rev 5939) +++ trunk/numpy/core/src/multiarraymodule.c 2008-10-08 13:36:29 UTC (rev 5940) @@ -2327,7 +2327,7 @@ NPY_CLIPMODE clipmode) { int n, elsize; - intp i, m; + intp i; char *ret_data; PyArrayObject **mps, *ap; PyArrayMultiIterObject *multi=NULL; Modified: trunk/numpy/core/src/scalartypes.inc.src =================================================================== --- trunk/numpy/core/src/scalartypes.inc.src 2008-10-08 13:35:27 UTC (rev 5939) +++ trunk/numpy/core/src/scalartypes.inc.src 2008-10-08 13:36:29 UTC (rev 5940) @@ -2022,12 +2022,15 @@ #default=0*16,1*2,2# */ -#define _NPY_UNUSED1 -#define _NPY_UNUSEDz -#define _NPY_UNUSED0 NPY_UNUSED +#define _NPY_UNUSED2_1 +#define _NPY_UNUSED2_z +#define _NPY_UNUSED2_0 NPY_UNUSED +#define _NPY_UNUSED1_0 +#define _NPY_UNUSED1_1 +#define _NPY_UNUSED1_2 NPY_UNUSED static PyObject * - at name@_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *_NPY_UNUSED at work@(kwds)) + at name@_arrtype_new(PyTypeObject *_NPY_UNUSED1_ at default@(type), PyObject *args, PyObject *_NPY_UNUSED2_ at work@(kwds)) { PyObject *obj = NULL; PyObject *robj; Modified: trunk/numpy/core/src/umathmodule.c.src =================================================================== --- trunk/numpy/core/src/umathmodule.c.src 2008-10-08 13:35:27 UTC (rev 5939) +++ trunk/numpy/core/src/umathmodule.c.src 2008-10-08 13:36:29 UTC (rev 5940) @@ -56,7 +56,7 @@ } static PyObject * -Py_get_one(PyObject *o) +Py_get_one(PyObject *NPY_UNUSED(o)) { return PyInt_FromLong(1); } @@ -604,7 +604,7 @@ /**end repeat**/ static void -BOOL_ones_like(char **args, intp *dimensions, intp *steps, void *data) +BOOL_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { OUTPUT_LOOP { *((Bool *)op) = 1; @@ -633,7 +633,7 @@ #define @S@@TYPE at _floor_divide @S@@TYPE at _divide static void - at S@@TYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { OUTPUT_LOOP { *((@s@@type@ *)op) = 1; @@ -641,7 +641,7 @@ } static void - at S@@TYPE at _square(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _square(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -650,7 +650,7 @@ } static void - at S@@TYPE at _reciprocal(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _reciprocal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -1032,7 +1032,7 @@ } static void - at TYPE@_square(char **args, intp *dimensions, intp *steps, void *data) + at TYPE@_square(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1041,7 +1041,7 @@ } static void - at TYPE@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) + at TYPE@_reciprocal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1050,7 +1050,7 @@ } static void - at TYPE@_ones_like(char **args, intp *dimensions, intp *steps, void *data) + at TYPE@_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { OUTPUT_LOOP { *((@type@ *)op) = 1; @@ -1314,7 +1314,7 @@ /**end repeat1**/ static void - at CTYPE@_square(char **args, intp *dimensions, intp *steps, void *data) + at CTYPE@_square(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1325,7 +1325,7 @@ } static void - at CTYPE@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) + at CTYPE@_reciprocal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1345,7 +1345,7 @@ } static void - at CTYPE@_ones_like(char **args, intp *dimensions, intp *steps, void *data) + at CTYPE@_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { OUTPUT_LOOP { ((@type@ *)op)[0] = 1; From numpy-svn at scipy.org Wed Oct 8 09:37:20 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 8 Oct 2008 08:37:20 -0500 (CDT) Subject: [Numpy-svn] r5941 - trunk/numpy/lib/src Message-ID: <20081008133720.9E5DE39C27D@scipy.org> Author: cdavid Date: 2008-10-08 08:37:04 -0500 (Wed, 08 Oct 2008) New Revision: 5941 Modified: trunk/numpy/lib/src/_compiled_base.c Log: Tag unused variables in numpy.lib C code. Modified: trunk/numpy/lib/src/_compiled_base.c =================================================================== --- trunk/numpy/lib/src/_compiled_base.c 2008-10-08 13:36:29 UTC (rev 5940) +++ trunk/numpy/lib/src/_compiled_base.c 2008-10-08 13:37:04 UTC (rev 5941) @@ -80,7 +80,7 @@ static PyObject * -arr_bincount(PyObject *self, PyObject *args, PyObject *kwds) +arr_bincount(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwds) { /* arr_bincount is registered as bincount. * bincount accepts one or two arguments. The first is an array of @@ -147,7 +147,7 @@ static PyObject * -arr_digitize(PyObject *self, PyObject *args, PyObject *kwds) +arr_digitize(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwds) { /* digitize (x, bins) returns an array of python integers the same length of x. The values i returned are such that bins [i - 1] <= x < @@ -219,7 +219,7 @@ static char arr_insert__doc__[] = "Insert vals sequentially into equivalent 1-d positions indicated by mask."; static PyObject * -arr_insert(PyObject *self, PyObject *args, PyObject *kwdict) +arr_insert(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwdict) { /* Returns input array with values inserted sequentially into places indicated by the mask @@ -379,7 +379,7 @@ } static PyObject * -arr_interp(PyObject *self, PyObject *args, PyObject *kwdict) +arr_interp(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwdict) { PyObject *fp, *xp, *x; @@ -474,7 +474,7 @@ /* Can only be called if doc is currently NULL */ static PyObject * -arr_add_docstring(PyObject *dummy, PyObject *args) +arr_add_docstring(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *obj; PyObject *str; @@ -624,11 +624,11 @@ static void _unpackbits( void *In, - int el_size, /* unused */ + int NPY_UNUSED(el_size), /* unused */ npy_intp in_N, npy_intp in_stride, void *Out, - npy_intp out_N, + npy_intp NPY_UNUSED(out_N), npy_intp out_stride ) { @@ -772,7 +772,7 @@ static PyObject * -io_pack(PyObject *self, PyObject *args, PyObject *kwds) +io_pack(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwds) { PyObject *obj; int axis=NPY_MAXDIMS; @@ -785,7 +785,7 @@ } static PyObject * -io_unpack(PyObject *self, PyObject *args, PyObject *kwds) +io_unpack(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwds) { PyObject *obj; int axis=NPY_MAXDIMS; From numpy-svn at scipy.org Wed Oct 8 09:37:54 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 8 Oct 2008 08:37:54 -0500 (CDT) Subject: [Numpy-svn] r5942 - trunk/numpy/numarray Message-ID: <20081008133754.C4B2139C27D@scipy.org> Author: cdavid Date: 2008-10-08 08:37:36 -0500 (Wed, 08 Oct 2008) New Revision: 5942 Modified: trunk/numpy/numarray/_capi.c Log: More unused vars tagged. Modified: trunk/numpy/numarray/_capi.c =================================================================== --- trunk/numpy/numarray/_capi.c 2008-10-08 13:37:04 UTC (rev 5941) +++ trunk/numpy/numarray/_capi.c 2008-10-08 13:37:36 UTC (rev 5942) @@ -225,7 +225,7 @@ ** should always be 0 * */ -static int int_dividebyzero_error(long value, long unused) { +static int int_dividebyzero_error(long NPY_UNUSED(value), long NPY_UNUSED(unused)) { double dummy; dummy = 1./numarray_zero; if (dummy) /* to prevent optimizer from eliminating expression */ @@ -876,7 +876,7 @@ cfunc and wrapper. */ static PyObject * -cfunc_call(PyObject *self, PyObject *argsTuple, PyObject *argsDict) +cfunc_call(PyObject *self, PyObject *argsTuple, PyObject *NPY_UNUSED(argsDict)) { CfuncObject *me = (CfuncObject *) self; switch(me->descr.type) { @@ -2546,9 +2546,9 @@ NA_callStrideConvCFuncCore( PyObject *self, int nshape, maybelong *shape, PyObject *inbuffObj, long inboffset, - int ninbstrides, maybelong *inbstrides, + int NPY_UNUSED(ninbstrides), maybelong *inbstrides, PyObject *outbuffObj, long outboffset, - int noutbstrides, maybelong *outbstrides, + int NPY_UNUSED(noutbstrides), maybelong *outbstrides, long nbytes) { CfuncObject *me = (CfuncObject *) self; @@ -2627,17 +2627,17 @@ } static int -NA_OperatorCheck(PyObject *op) { +NA_OperatorCheck(PyObject *NPY_UNUSED(op)) { return 0; } static int -NA_ConverterCheck(PyObject *op) { +NA_ConverterCheck(PyObject *NPY_UNUSED(op)) { return 0; } static int -NA_UfuncCheck(PyObject *op) { +NA_UfuncCheck(PyObject *NPY_UNUSED(op)) { return 0; } @@ -2647,8 +2647,8 @@ } static int -NA_getByteOffset(PyArrayObject *array, int nindices, maybelong *indices, - long *offset) +NA_getByteOffset(PyArrayObject *NPY_UNUSED(array), int NPY_UNUSED(nindices), + maybelong *NPY_UNUSED(indices), long *NPY_UNUSED(offset)) { return 0; } @@ -2742,8 +2742,9 @@ /* ignores bytestride */ static PyArrayObject * NA_NewAllFromBuffer(int ndim, maybelong *shape, NumarrayType type, - PyObject *bufferObject, maybelong byteoffset, maybelong bytestride, - int byteorder, int aligned, int writeable) + PyObject *bufferObject, maybelong byteoffset, + maybelong NPY_UNUSED(bytestride), int byteorder, + int NPY_UNUSED(aligned), int NPY_UNUSED(writeable)) { PyArrayObject *self = NULL; PyArray_Descr *dtype; @@ -2822,17 +2823,17 @@ } static int -NA_OperatorCheckExact(PyObject *op) { +NA_OperatorCheckExact(PyObject *NPY_UNUSED(op)) { return 0; } static int -NA_ConverterCheckExact(PyObject *op) { +NA_ConverterCheckExact(PyObject *NPY_UNUSED(op)) { return 0; } static int -NA_UfuncCheckExact(PyObject *op) { +NA_UfuncCheckExact(PyObject *NPY_UNUSED(op)) { return 0; } @@ -2854,7 +2855,7 @@ /* Byteswap is not a flag of the array --- it is implicit in the data-type */ static void -NA_updateByteswap(PyArrayObject *self) +NA_updateByteswap(PyArrayObject *NPY_UNUSED(self)) { return; } From numpy-svn at scipy.org Wed Oct 8 09:38:22 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 8 Oct 2008 08:38:22 -0500 (CDT) Subject: [Numpy-svn] r5943 - trunk/numpy/fft Message-ID: <20081008133822.4123D39C27D@scipy.org> Author: cdavid Date: 2008-10-08 08:38:11 -0500 (Wed, 08 Oct 2008) New Revision: 5943 Modified: trunk/numpy/fft/fftpack_litemodule.c Log: More unused vars tagged (fftpack). Modified: trunk/numpy/fft/fftpack_litemodule.c =================================================================== --- trunk/numpy/fft/fftpack_litemodule.c 2008-10-08 13:37:36 UTC (rev 5942) +++ trunk/numpy/fft/fftpack_litemodule.c 2008-10-08 13:38:11 UTC (rev 5943) @@ -9,7 +9,7 @@ static char fftpack_cfftf__doc__[] = ""; PyObject * -fftpack_cfftf(PyObject *self, PyObject *args) +fftpack_cfftf(PyObject *NPY_UNUSED(self), PyObject *args) { PyObject *op1, *op2; PyArrayObject *data; @@ -60,7 +60,7 @@ static char fftpack_cfftb__doc__[] = ""; PyObject * -fftpack_cfftb(PyObject *self, PyObject *args) +fftpack_cfftb(PyObject *NPY_UNUSED(self), PyObject *args) { PyObject *op1, *op2; PyArrayObject *data; @@ -111,7 +111,7 @@ static char fftpack_cffti__doc__[] =""; static PyObject * -fftpack_cffti(PyObject *self, PyObject *args) +fftpack_cffti(PyObject *NPY_UNUSED(self), PyObject *args) { PyArrayObject *op; npy_intp dim; @@ -138,7 +138,7 @@ static char fftpack_rfftf__doc__[] =""; PyObject * -fftpack_rfftf(PyObject *self, PyObject *args) +fftpack_rfftf(PyObject *NPY_UNUSED(self), PyObject *args) { PyObject *op1, *op2; PyArrayObject *data, *ret; @@ -204,7 +204,7 @@ PyObject * -fftpack_rfftb(PyObject *self, PyObject *args) +fftpack_rfftb(PyObject *NPY_UNUSED(self), PyObject *args) { PyObject *op1, *op2; PyArrayObject *data, *ret; @@ -265,7 +265,7 @@ static char fftpack_rffti__doc__[] =""; static PyObject * -fftpack_rffti(PyObject *self, PyObject *args) +fftpack_rffti(PyObject *NPY_UNUSED(self), PyObject *args) { PyArrayObject *op; npy_intp dim; From numpy-svn at scipy.org Wed Oct 8 09:38:47 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 8 Oct 2008 08:38:47 -0500 (CDT) Subject: [Numpy-svn] r5944 - trunk/numpy/linalg Message-ID: <20081008133847.0D8B939C27D@scipy.org> Author: cdavid Date: 2008-10-08 08:38:35 -0500 (Wed, 08 Oct 2008) New Revision: 5944 Modified: trunk/numpy/linalg/lapack_litemodule.c Log: More unused vars tagged (lapack_lite). Modified: trunk/numpy/linalg/lapack_litemodule.c =================================================================== --- trunk/numpy/linalg/lapack_litemodule.c 2008-10-08 13:38:11 UTC (rev 5943) +++ trunk/numpy/linalg/lapack_litemodule.c 2008-10-08 13:38:35 UTC (rev 5944) @@ -129,7 +129,7 @@ #define IDATA(p) ((int *) (((PyArrayObject *)p)->data)) static PyObject * -lapack_lite_dgeev(PyObject *self, PyObject *args) +lapack_lite_dgeev(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; char jobvl; @@ -169,7 +169,7 @@ } static PyObject * -lapack_lite_dsyevd(PyObject *self, PyObject *args) +lapack_lite_dsyevd(PyObject *NPY_UNUSED(self), PyObject *args) { /* Arguments */ /* ========= */ @@ -251,7 +251,7 @@ } static PyObject * -lapack_lite_zheevd(PyObject *self, PyObject *args) +lapack_lite_zheevd(PyObject *NPY_UNUSED(self), PyObject *args) { /* Arguments */ /* ========= */ @@ -339,7 +339,7 @@ } static PyObject * -lapack_lite_dgelsd(PyObject *self, PyObject *args) +lapack_lite_dgelsd(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m; @@ -378,7 +378,7 @@ } static PyObject * -lapack_lite_dgesv(PyObject *self, PyObject *args) +lapack_lite_dgesv(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int n; @@ -404,7 +404,7 @@ } static PyObject * -lapack_lite_dgesdd(PyObject *self, PyObject *args) +lapack_lite_dgesdd(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; char jobz; @@ -470,7 +470,7 @@ } static PyObject * -lapack_lite_dgetrf(PyObject *self, PyObject *args) +lapack_lite_dgetrf(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m; @@ -492,7 +492,7 @@ } static PyObject * -lapack_lite_dpotrf(PyObject *self, PyObject *args) +lapack_lite_dpotrf(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int n; @@ -512,7 +512,7 @@ } static PyObject * -lapack_lite_dgeqrf(PyObject *self, PyObject *args) +lapack_lite_dgeqrf(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m, n, lwork; @@ -538,7 +538,7 @@ static PyObject * -lapack_lite_dorgqr(PyObject *self, PyObject *args) +lapack_lite_dorgqr(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m, n, k, lwork; @@ -559,7 +559,7 @@ static PyObject * -lapack_lite_zgeev(PyObject *self, PyObject *args) +lapack_lite_zgeev(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; char jobvl; @@ -599,7 +599,7 @@ } static PyObject * -lapack_lite_zgelsd(PyObject *self, PyObject *args) +lapack_lite_zgelsd(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m; @@ -638,7 +638,7 @@ } static PyObject * -lapack_lite_zgesv(PyObject *self, PyObject *args) +lapack_lite_zgesv(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int n; @@ -664,7 +664,7 @@ } static PyObject * -lapack_lite_zgesdd(PyObject *self, PyObject *args) +lapack_lite_zgesdd(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; char jobz; @@ -706,7 +706,7 @@ } static PyObject * -lapack_lite_zgetrf(PyObject *self, PyObject *args) +lapack_lite_zgetrf(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m; @@ -728,7 +728,7 @@ } static PyObject * -lapack_lite_zpotrf(PyObject *self, PyObject *args) +lapack_lite_zpotrf(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int n; @@ -747,7 +747,7 @@ } static PyObject * -lapack_lite_zgeqrf(PyObject *self, PyObject *args) +lapack_lite_zgeqrf(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m, n, lwork; @@ -770,7 +770,7 @@ static PyObject * -lapack_lite_zungqr(PyObject *self, PyObject *args) +lapack_lite_zungqr(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m, n, k, lwork; From numpy-svn at scipy.org Thu Oct 9 17:53:14 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 9 Oct 2008 16:53:14 -0500 (CDT) Subject: [Numpy-svn] r5945 - branches/1.2.x/numpy/lib Message-ID: <20081009215314.02E7E39C1AE@scipy.org> Author: jarrod.millman Date: 2008-10-09 16:53:12 -0500 (Thu, 09 Oct 2008) New Revision: 5945 Modified: branches/1.2.x/numpy/lib/utils.py Log: back ported Pauli Virtanen's fix for py 2.4 compatible lookfor (see r5862) Modified: branches/1.2.x/numpy/lib/utils.py =================================================================== --- branches/1.2.x/numpy/lib/utils.py 2008-10-08 13:38:35 UTC (rev 5944) +++ branches/1.2.x/numpy/lib/utils.py 2008-10-09 21:53:12 UTC (rev 5945) @@ -1,6 +1,5 @@ import os import sys -import pkgutil import types import re @@ -682,15 +681,21 @@ _all = item.__all__ except AttributeError: _all = None + # import sub-packages if import_modules and hasattr(item, '__path__'): - for m in pkgutil.iter_modules(item.__path__): - if _all is not None and m[1] not in _all: - continue - try: - __import__("%s.%s" % (name, m[1])) - except ImportError: - continue + for pth in item.__path__: + for mod_path in os.listdir(pth): + init_py = os.path.join(pth, mod_path, '__init__.py') + if not os.path.isfile(init_py): + continue + if _all is not None and mod_path not in _all: + continue + try: + __import__("%s.%s" % (name, mod_path)) + except ImportError: + continue + for n, v in inspect.getmembers(item): if _all is not None and n not in _all: continue From numpy-svn at scipy.org Fri Oct 17 22:15:19 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 17 Oct 2008 21:15:19 -0500 (CDT) Subject: [Numpy-svn] r5946 - in trunk/numpy/ma: . tests Message-ID: <20081018021519.22C1039C0EA@scipy.org> Author: pierregm Date: 2008-10-17 21:14:51 -0500 (Fri, 17 Oct 2008) New Revision: 5946 Modified: trunk/numpy/ma/core.py trunk/numpy/ma/mrecords.py trunk/numpy/ma/tests/test_core.py trunk/numpy/ma/tests/test_mrecords.py trunk/numpy/ma/tests/test_subclassing.py Log: core : * fixed make_mask_descr to recognize subdtypes : * fixed some corner cases of view mrecords : * fixed view : * got rid of _fieldmask for _mask : * WARNING: setting ._mask no longer calls __setmask__ : BE CAREFUL. : * prevent setting ._mask directly, as it screws up things: use .mask instead test_subclassing : * clean up Modified: trunk/numpy/ma/core.py =================================================================== --- trunk/numpy/ma/core.py 2008-10-09 21:53:12 UTC (rev 5945) +++ trunk/numpy/ma/core.py 2008-10-18 02:14:51 UTC (rev 5946) @@ -749,11 +749,20 @@ Each field is set to a bool. """ + # Make sure we do have a dtype + if not isinstance(ndtype, np.dtype): + ndtype = np.dtype(ndtype) + # Do we have some name fields ? if ndtype.names: mdescr = [list(_) for _ in ndtype.descr] for m in mdescr: m[1] = '|b1' - return [tuple(_) for _ in mdescr] + return np.dtype([tuple(_) for _ in mdescr]) + # Is this some kind of composite a la (np.float,2) + elif ndtype.subdtype: + mdescr = list(ndtype.subdtype) + mdescr[0] = np.dtype(bool) + return np.dtype(tuple(mdescr)) else: return MaskType @@ -1434,20 +1443,33 @@ return result #............................................. def view(self, dtype=None, type=None): - if dtype is not None: + if dtype is None: if type is None: - args = (dtype,) + output = ndarray.view(self) else: - args = (dtype, type) + output = ndarray.view(self, type) elif type is None: - args = () + try: + if issubclass(dtype, ndarray): + output = ndarray.view(self, dtype) + dtype = None + else: + output = ndarray.view(self, dtype) + except TypeError: + output = ndarray.view(self, dtype) else: - args = (type,) - output = ndarray.view(self, *args) + output = ndarray.view(self, dtype, type) + # Should we update the mask ? if (getattr(output,'_mask', nomask) is not nomask): - mdtype = make_mask_descr(output.dtype) + if dtype is None: + dtype = output.dtype + mdtype = make_mask_descr(dtype) + output._mask = self._mask.view(mdtype, ndarray) output._mask.shape = output.shape + # Make sure to reset the _fill_value if needed + if getattr(output, '_fill_value', None): + output._fill_value = None return output view.__doc__ = ndarray.view.__doc__ #............................................. @@ -1996,7 +2018,7 @@ # def __rmul__(self, other): "Multiply other by self, and return a new masked array." - return multiply(self, other) + return multiply(other, self) # def __div__(self, other): "Divide other into self, and return a new masked array." Modified: trunk/numpy/ma/mrecords.py =================================================================== --- trunk/numpy/ma/mrecords.py 2008-10-09 21:53:12 UTC (rev 5945) +++ trunk/numpy/ma/mrecords.py 2008-10-18 02:14:51 UTC (rev 5946) @@ -106,8 +106,6 @@ _fill_value : {record} Filling values for each field. """ - _defaultfieldmask = nomask - _defaulthardmask = False #............................................ def __new__(cls, shape, dtype=None, buf=None, offset=0, strides=None, formats=None, names=None, titles=None, @@ -164,7 +162,7 @@ dtype=mdescr).view(recarray) # Update some of the attributes _dict = self.__dict__ - _dict.update(_mask=_mask, _fieldmask=_mask) + _dict.update(_mask=_mask) self._update_from(obj) if _dict['_baseclass'] == ndarray: _dict['_baseclass'] = recarray @@ -226,7 +224,7 @@ def __setattr__(self, attr, val): "Sets the attribute attr to the value val." # Should we call __setmask__ first ? - if attr in ['_mask','mask','_fieldmask','fieldmask']: + if attr in ['mask', 'fieldmask']: self.__setmask__(val) return # Create a shortcut (so that we don't have to call getattr all the time) @@ -331,18 +329,44 @@ reprstr.extend([fmt % (' fill_value', self.fill_value), ' )']) return str("\n".join(reprstr)) - #...................................................... - def view(self, obj): +# #...................................................... + def view(self, dtype=None, type=None): """Returns a view of the mrecarray.""" - try: - if issubclass(obj, ndarray): - return ndarray.view(self, obj) - except TypeError: - pass - dtype_ = np.dtype(obj) - if dtype_.fields is None: - return self.__array__().view(dtype_) - return ndarray.view(self, obj) + # OK, basic copy-paste from MaskedArray.view... + if dtype is None: + if type is None: + output = ndarray.view(self) + else: + output = ndarray.view(self, type) + # Here again... + elif type is None: + try: + if issubclass(dtype, ndarray): + output = ndarray.view(self, dtype) + dtype = None + else: + output = ndarray.view(self, dtype) + # OK, there's the change + except TypeError: + dtype = np.dtype(dtype) + # we need to revert to MaskedArray, but keeping the possibility + # ...of subclasses (eg, TimeSeriesRecords), so we'll force a type + # ...set to the first parent + if dtype.fields is None: + basetype = self.__class__.__bases__[0] + output = self.__array__().view(dtype, basetype) + output._update_from(self) + else: + output = ndarray.view(self, dtype) + output._fill_value = None + else: + output = ndarray.view(self, dtype, type) + # Update the mask, just like in MaskedArray.view + if (getattr(output,'_mask', nomask) is not nomask): + mdtype = ma.make_mask_descr(output.dtype) + output._mask = self._mask.view(mdtype, ndarray) + output._mask.shape = output.shape + return output def harden_mask(self): "Forces the mask to hard" @@ -355,7 +379,7 @@ """Returns a copy of the masked record.""" _localdict = self.__dict__ copied = self._data.copy().view(type(self)) - copied._fieldmask = self._fieldmask.copy() + copied._mask = self._mask.copy() return copied def tolist(self, fill_value=None): @@ -371,7 +395,7 @@ if fill_value is not None: return self.filled(fill_value).tolist() result = narray(self.filled().tolist(), dtype=object) - mask = narray(self._fieldmask.tolist()) + mask = narray(self._mask.tolist()) result[mask] = None return result.tolist() #-------------------------------------------- @@ -385,7 +409,7 @@ self.dtype, self.flags.fnc, self._data.tostring(), - self._fieldmask.tostring(), + self._mask.tostring(), self._fill_value, ) return state @@ -405,7 +429,7 @@ (ver, shp, typ, isf, raw, msk, flv) = state ndarray.__setstate__(self, (shp, typ, isf, raw)) mdtype = dtype([(k,bool_) for (k,_) in self.dtype.descr]) - self.__dict__['_fieldmask'].__setstate__((shp, mdtype, isf, msk)) + self.__dict__['_mask'].__setstate__((shp, mdtype, isf, msk)) self.fill_value = flv # def __reduce__(self): @@ -508,7 +532,7 @@ Lists of tuples should be preferred over lists of lists for faster processing. """ # Grab the initial _fieldmask, if needed: - _fieldmask = getattr(reclist, '_fieldmask', None) + _mask = getattr(reclist, '_mask', None) # Get the list of records..... try: nfields = len(reclist[0]) @@ -533,13 +557,13 @@ mask = np.array(mask, copy=False) maskrecordlength = len(mask.dtype) if maskrecordlength: - mrec._fieldmask.flat = mask + mrec._mask.flat = mask elif len(mask.shape) == 2: - mrec._fieldmask.flat = [tuple(m) for m in mask] + mrec._mask.flat = [tuple(m) for m in mask] else: - mrec._mask = mask - if _fieldmask is not None: - mrec._fieldmask[:] = _fieldmask + mrec.__setmask__(mask) + if _mask is not None: + mrec._mask[:] = _mask return mrec def _guessvartypes(arr): @@ -680,5 +704,5 @@ # Add the mask of the new field newmask.setfield(getmaskarray(newfield), *newmask.dtype.fields[newfieldname]) - newdata._fieldmask = newmask + newdata._mask = newmask return newdata Modified: trunk/numpy/ma/tests/test_core.py =================================================================== --- trunk/numpy/ma/tests/test_core.py 2008-10-09 21:53:12 UTC (rev 5945) +++ trunk/numpy/ma/tests/test_core.py 2008-10-18 02:14:51 UTC (rev 5946) @@ -2270,6 +2270,21 @@ self.failUnless(c[0,0] is masked) self.failUnless(c.flags['C']) + + def test_make_mask_descr(self): + "Test make_mask_descr" + ntype = [('a',np.float), ('b',np.float)] + test = make_mask_descr(ntype) + assert_equal(test, [('a',np.bool),('b',np.bool)]) + # + ntype = (np.float, 2) + test = make_mask_descr(ntype) + assert_equal(test, (np.bool,2)) + # + ntype = np.float + test = make_mask_descr(ntype) + assert_equal(test, np.dtype(np.bool)) + #------------------------------------------------------------------------------ class TestMaskedFields(TestCase): @@ -2361,23 +2376,15 @@ a = array(iterator, dtype=[('a',float),('b',float)]) a.mask[0] = (1,0) controlmask = np.array([1]+19*[0], dtype=bool) - # + # Transform globally to simple dtype test = a.view(float) assert_equal(test, data.ravel()) assert_equal(test.mask, controlmask) - # + # Transform globally to dty test = a.view((float,2)) assert_equal(test, data) assert_equal(test.mask, controlmask.reshape(-1,2)) # - test = a.view([('A',float),('B',float)]) - assert_equal(test.mask.dtype.names, ('A', 'B')) - assert_equal(test['A'], a['a']) - assert_equal(test['B'], a['b']) - # - test = a.view(np.ndarray) - assert_equal(test, a._data) - # test = a.view((float,2), np.matrix) assert_equal(test, data) self.failUnless(isinstance(test, np.matrix)) @@ -2399,6 +2406,86 @@ assert_equal_records(a[-2]._data, a._data[-2]) assert_equal_records(a[-2]._mask, a._mask[-2]) + +class TestMaskedView(TestCase): + # + def setUp(self): + iterator = zip(np.arange(10), np.random.rand(10)) + data = np.array(iterator) + a = array(iterator, dtype=[('a',float),('b',float)]) + a.mask[0] = (1,0) + controlmask = np.array([1]+19*[0], dtype=bool) + self.data = (data, a, controlmask) + # + def test_view_to_nothing(self): + (data, a, controlmask) = self.data + test = a.view() + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test._data, a._data) + assert_equal(test._mask, a._mask) + + # + def test_view_to_type(self): + (data, a, controlmask) = self.data + test = a.view(np.ndarray) + self.failUnless(not isinstance(test, MaskedArray)) + assert_equal(test, a._data) + assert_equal_records(test, data.view(a.dtype).squeeze()) + # + def test_view_to_simple_dtype(self): + (data, a, controlmask) = self.data + # View globally + test = a.view(float) + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test, data.ravel()) + assert_equal(test.mask, controlmask) + # + def test_view_to_flexible_dtype(self): + (data, a, controlmask) = self.data + # + test = a.view([('A',float),('B',float)]) + assert_equal(test.mask.dtype.names, ('A', 'B')) + assert_equal(test['A'], a['a']) + assert_equal(test['B'], a['b']) + # + test = a[0].view([('A',float),('B',float)]) + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test.mask.dtype.names, ('A', 'B')) + assert_equal(test['A'], a['a'][0]) + assert_equal(test['B'], a['b'][0]) + # + test = a[-1].view([('A',float),('B',float)]) + self.failUnless(not isinstance(test, MaskedArray)) + assert_equal(test.dtype.names, ('A', 'B')) + assert_equal(test['A'], a['a'][-1]) + assert_equal(test['B'], a['b'][-1]) + + # + def test_view_to_subdtype(self): + (data, a, controlmask) = self.data + # View globally + test = a.view((float,2)) + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test, data) + assert_equal(test.mask, controlmask.reshape(-1,2)) + # View on 1 masked element + test = a[0].view((float,2)) + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test, data[0]) + assert_equal(test.mask, (1,0)) + # View on 1 unmasked element + test = a[-1].view((float,2)) + self.failUnless(not isinstance(test, MaskedArray)) + assert_equal(test, data[-1]) + # + def test_view_to_dtype_and_type(self): + (data, a, controlmask) = self.data + # + test = a.view((float,2), np.matrix) + assert_equal(test, data) + self.failUnless(isinstance(test, np.matrix)) + self.failUnless(not isinstance(test, MaskedArray)) + ############################################################################### #------------------------------------------------------------------------------ if __name__ == "__main__": Modified: trunk/numpy/ma/tests/test_mrecords.py =================================================================== --- trunk/numpy/ma/tests/test_mrecords.py 2008-10-09 21:53:12 UTC (rev 5945) +++ trunk/numpy/ma/tests/test_mrecords.py 2008-10-18 02:14:51 UTC (rev 5946) @@ -65,8 +65,6 @@ assert_equal(mbase_first.tolist(), (1,1.1,'one')) # Used to be mask, now it's recordmask assert_equal(mbase_first.recordmask, nomask) - # _fieldmask and _mask should be the same thing - assert_equal(mbase_first._fieldmask.item(), (False, False, False)) assert_equal(mbase_first._mask.item(), (False, False, False)) assert_equal(mbase_first['a'], mbase['a'][0]) mbase_last = mbase[-1] @@ -75,7 +73,7 @@ assert_equal(mbase_last.tolist(), (None,None,None)) # Used to be mask, now it's recordmask assert_equal(mbase_last.recordmask, True) - assert_equal(mbase_last._fieldmask.item(), (True, True, True)) + assert_equal(mbase_last._mask.item(), (True, True, True)) assert_equal(mbase_last['a'], mbase['a'][-1]) assert (mbase_last['a'] is masked) # as slice .......... @@ -107,7 +105,7 @@ assert_equal(ma.getmaskarray(mbase['a']), [0]*5) # Use to be _mask, now it's recordmask assert_equal(mbase.recordmask, [False]*5) - assert_equal(mbase._fieldmask.tolist(), + assert_equal(mbase._mask.tolist(), np.array([(0,0,0),(0,1,1),(0,0,0),(0,0,0),(0,1,1)], dtype=bool)) # Set a field to mask ........................ @@ -117,7 +115,7 @@ assert_equal(mbase.c.recordmask, [1]*5) assert_equal(ma.getmaskarray(mbase['c']), [1]*5) assert_equal(ma.getdata(mbase['c']), ['N/A']*5) - assert_equal(mbase._fieldmask.tolist(), + assert_equal(mbase._mask.tolist(), np.array([(0,0,1),(0,1,1),(0,0,1),(0,0,1),(0,1,1)], dtype=bool)) # Set fields by slices ....................... @@ -159,23 +157,23 @@ base = self.base.copy() mbase = base.view(mrecarray) # Set the mask to True ....................... - mbase._mask = masked + mbase.mask = masked assert_equal(ma.getmaskarray(mbase['b']), [1]*5) assert_equal(mbase['a']._mask, mbase['b']._mask) assert_equal(mbase['a']._mask, mbase['c']._mask) - assert_equal(mbase._fieldmask.tolist(), + assert_equal(mbase._mask.tolist(), np.array([(1,1,1)]*5, dtype=bool)) # Delete the mask ............................ - mbase._mask = nomask + mbase.mask = nomask assert_equal(ma.getmaskarray(mbase['c']), [0]*5) - assert_equal(mbase._fieldmask.tolist(), + assert_equal(mbase._mask.tolist(), np.array([(0,0,0)]*5, dtype=bool)) # def test_set_mask_fromarray(self): base = self.base.copy() mbase = base.view(mrecarray) # Sets the mask w/ an array - mbase._mask = [1,0,0,0,1] + mbase.mask = [1,0,0,0,1] assert_equal(mbase.a.mask, [1,0,0,0,1]) assert_equal(mbase.b.mask, [1,0,0,0,1]) assert_equal(mbase.c.mask, [1,0,0,0,1]) @@ -206,7 +204,7 @@ # Set an element to mask ..................... mbase = base.view(mrecarray).copy() mbase[-2] = masked - assert_equal(mbase._fieldmask.tolist(), + assert_equal(mbase._mask.tolist(), np.array([(0,0,0),(1,1,1),(0,0,0),(1,1,1),(1,1,1)], dtype=bool)) # Used to be mask, now it's recordmask! @@ -265,11 +263,11 @@ mbase = base.view(mrecarray) mbase.harden_mask() self.failUnless(mbase._hardmask) - mbase._mask = nomask + mbase.mask = nomask assert_equal_records(mbase._mask, base._mask) mbase.soften_mask() self.failUnless(not mbase._hardmask) - mbase._mask = nomask + mbase.mask = nomask # So, the mask of a field is no longer set to nomask... assert_equal_records(mbase._mask, ma.make_mask_none(base.shape,base.dtype)) @@ -286,7 +284,7 @@ assert_equal(mrec_.dtype, mrec.dtype) assert_equal_records(mrec_._data, mrec._data) assert_equal(mrec_._mask, mrec._mask) - assert_equal_records(mrec_._fieldmask, mrec._fieldmask) + assert_equal_records(mrec_._mask, mrec._mask) # def test_filled(self): "Test filling the array" @@ -340,6 +338,45 @@ np.array([(0,0,0),(1,1,1)], dtype=mult.dtype)) +class TestView(TestCase): + # + def setUp(self): + (a, b) = (np.arange(10), np.random.rand(10)) + ndtype = [('a',np.float), ('b',np.float)] + arr = np.array(zip(a,b), dtype=ndtype) + rec = arr.view(np.recarray) + # + marr = ma.array(zip(a,b), dtype=ndtype, fill_value=(-9., -99.)) + mrec = fromarrays([a,b], dtype=ndtype, fill_value=(-9., -99.)) + mrec.mask[3] = (False, True) + self.data = (mrec, a, b, arr) + # + def test_view_by_itself(self): + (mrec, a, b, arr) = self.data + test = mrec.view() + self.failUnless(isinstance(test, MaskedRecords)) + assert_equal_records(test, mrec) + assert_equal_records(test._mask, mrec._mask) + # + def test_view_simple_dtype(self): + (mrec, a, b, arr) = self.data + ntype = (np.float, 2) + test = mrec.view(ntype) + assert(isinstance(test, ma.MaskedArray)) + assert_equal(test, np.array(zip(a,b), dtype=np.float)) + assert(test[3,1] is ma.masked) + # + def test_view_flexible_type(self): + (mrec, a, b, arr) = self.data + alttype = [('A',np.float), ('B',np.float)] + test = mrec.view(alttype) + assert(isinstance(test, MaskedRecords)) + assert_equal_records(test, arr.view(alttype)) + assert(test['B'][3] is masked) + assert_equal(test.dtype, np.dtype(alttype)) + assert(test._fill_value is None) + + ################################################################################ class TestMRecordsImport(TestCase): "Base test class for MaskedArrays." @@ -395,7 +432,7 @@ _mrec = fromrecords(mrec) assert_equal(_mrec.dtype, mrec.dtype) assert_equal_records(_mrec._data, mrec.filled()) - assert_equal_records(_mrec._fieldmask, mrec._fieldmask) + assert_equal_records(_mrec._mask, mrec._mask) def test_fromrecords_wmask(self): "Tests construction from records w/ mask." @@ -403,20 +440,20 @@ # _mrec = fromrecords(nrec.tolist(), dtype=ddtype, mask=[0,1,0,]) assert_equal_records(_mrec._data, mrec._data) - assert_equal(_mrec._fieldmask.tolist(), [(0,0,0),(1,1,1),(0,0,0)]) + assert_equal(_mrec._mask.tolist(), [(0,0,0),(1,1,1),(0,0,0)]) # _mrec = fromrecords(nrec.tolist(), dtype=ddtype, mask=True) assert_equal_records(_mrec._data, mrec._data) - assert_equal(_mrec._fieldmask.tolist(), [(1,1,1),(1,1,1),(1,1,1)]) + assert_equal(_mrec._mask.tolist(), [(1,1,1),(1,1,1),(1,1,1)]) # - _mrec = fromrecords(nrec.tolist(), dtype=ddtype, mask=mrec._fieldmask) + _mrec = fromrecords(nrec.tolist(), dtype=ddtype, mask=mrec._mask) assert_equal_records(_mrec._data, mrec._data) - assert_equal(_mrec._fieldmask.tolist(), mrec._fieldmask.tolist()) + assert_equal(_mrec._mask.tolist(), mrec._mask.tolist()) # _mrec = fromrecords(nrec.tolist(), dtype=ddtype, - mask=mrec._fieldmask.tolist()) + mask=mrec._mask.tolist()) assert_equal_records(_mrec._data, mrec._data) - assert_equal(_mrec._fieldmask.tolist(), mrec._fieldmask.tolist()) + assert_equal(_mrec._mask.tolist(), mrec._mask.tolist()) def test_fromtextfile(self): "Tests reading from a text file." Modified: trunk/numpy/ma/tests/test_subclassing.py =================================================================== --- trunk/numpy/ma/tests/test_subclassing.py 2008-10-09 21:53:12 UTC (rev 5945) +++ trunk/numpy/ma/tests/test_subclassing.py 2008-10-18 02:14:51 UTC (rev 5946) @@ -154,24 +154,4 @@ if __name__ == '__main__': run_module_suite() - if 0: - x = array(arange(5), mask=[0]+[1]*4) - my = masked_array(subarray(x)) - ym = msubarray(x) - # - z = (my+1) - self.failUnless(isinstance(z,MaskedArray)) - self.failUnless(not isinstance(z, MSubArray)) - self.failUnless(isinstance(z._data, SubArray)) - assert_equal(z._data.info, {}) - # - z = (ym+1) - self.failUnless(isinstance(z, MaskedArray)) - self.failUnless(isinstance(z, MSubArray)) - self.failUnless(isinstance(z._data, SubArray)) - self.failUnless(z._data.info['added'] > 0) - # - ym._set_mask([1,0,0,0,1]) - assert_equal(ym._mask, [1,0,0,0,1]) - ym._series._set_mask([0,0,0,0,1]) - assert_equal(ym._mask, [0,0,0,0,1]) + From numpy-svn at scipy.org Sun Oct 19 15:33:12 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 19 Oct 2008 14:33:12 -0500 (CDT) Subject: [Numpy-svn] r5947 - trunk/numpy/ma/tests Message-ID: <20081019193312.D956C39C088@scipy.org> Author: pierregm Date: 2008-10-19 14:33:10 -0500 (Sun, 19 Oct 2008) New Revision: 5947 Modified: trunk/numpy/ma/tests/test_mrecords.py Log: * make sure we call self.failUnless instead of assert Modified: trunk/numpy/ma/tests/test_mrecords.py =================================================================== --- trunk/numpy/ma/tests/test_mrecords.py 2008-10-18 02:14:51 UTC (rev 5946) +++ trunk/numpy/ma/tests/test_mrecords.py 2008-10-19 19:33:10 UTC (rev 5947) @@ -362,19 +362,19 @@ (mrec, a, b, arr) = self.data ntype = (np.float, 2) test = mrec.view(ntype) - assert(isinstance(test, ma.MaskedArray)) + self.failUnless(isinstance(test, ma.MaskedArray)) assert_equal(test, np.array(zip(a,b), dtype=np.float)) - assert(test[3,1] is ma.masked) + self.failUnless(test[3,1] is ma.masked) # def test_view_flexible_type(self): (mrec, a, b, arr) = self.data alttype = [('A',np.float), ('B',np.float)] test = mrec.view(alttype) - assert(isinstance(test, MaskedRecords)) + self.failUnless(isinstance(test, MaskedRecords)) assert_equal_records(test, arr.view(alttype)) - assert(test['B'][3] is masked) + self.failUnless(test['B'][3] is masked) assert_equal(test.dtype, np.dtype(alttype)) - assert(test._fill_value is None) + self.failUnless(test._fill_value is None) ################################################################################ From numpy-svn at scipy.org Sun Oct 19 15:33:53 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 19 Oct 2008 14:33:53 -0500 (CDT) Subject: [Numpy-svn] r5948 - in branches/1.2.x/numpy/ma: . tests Message-ID: <20081019193353.C0D4139C088@scipy.org> Author: pierregm Date: 2008-10-19 14:33:51 -0500 (Sun, 19 Oct 2008) New Revision: 5948 Modified: branches/1.2.x/numpy/ma/core.py branches/1.2.x/numpy/ma/tests/test_core.py Log: * Backporting fixes from 1.3.x r5946 Modified: branches/1.2.x/numpy/ma/core.py =================================================================== --- branches/1.2.x/numpy/ma/core.py 2008-10-19 19:33:10 UTC (rev 5947) +++ branches/1.2.x/numpy/ma/core.py 2008-10-19 19:33:51 UTC (rev 5948) @@ -749,11 +749,20 @@ Each field is set to a bool. """ + # Make sure we do have a dtype + if not isinstance(ndtype, np.dtype): + ndtype = np.dtype(ndtype) + # Do we have some name fields ? if ndtype.names: mdescr = [list(_) for _ in ndtype.descr] for m in mdescr: m[1] = '|b1' - return [tuple(_) for _ in mdescr] + return np.dtype([tuple(_) for _ in mdescr]) + # Is this some kind of composite a la (np.float,2) + elif ndtype.subdtype: + mdescr = list(ndtype.subdtype) + mdescr[0] = np.dtype(bool) + return np.dtype(tuple(mdescr)) else: return MaskType @@ -1434,20 +1443,33 @@ return result #............................................. def view(self, dtype=None, type=None): - if dtype is not None: + if dtype is None: if type is None: - args = (dtype,) + output = ndarray.view(self) else: - args = (dtype, type) + output = ndarray.view(self, type) elif type is None: - args = () + try: + if issubclass(dtype, ndarray): + output = ndarray.view(self, dtype) + dtype = None + else: + output = ndarray.view(self, dtype) + except TypeError: + output = ndarray.view(self, dtype) else: - args = (type,) - output = ndarray.view(self, *args) + output = ndarray.view(self, dtype, type) + # Should we update the mask ? if (getattr(output,'_mask', nomask) is not nomask): - mdtype = make_mask_descr(output.dtype) + if dtype is None: + dtype = output.dtype + mdtype = make_mask_descr(dtype) + output._mask = self._mask.view(mdtype, ndarray) output._mask.shape = output.shape + # Make sure to reset the _fill_value if needed + if getattr(output, '_fill_value', None): + output._fill_value = None return output view.__doc__ = ndarray.view.__doc__ #............................................. @@ -1996,7 +2018,7 @@ # def __rmul__(self, other): "Multiply other by self, and return a new masked array." - return multiply(self, other) + return multiply(other, self) # def __div__(self, other): "Divide other into self, and return a new masked array." Modified: branches/1.2.x/numpy/ma/tests/test_core.py =================================================================== --- branches/1.2.x/numpy/ma/tests/test_core.py 2008-10-19 19:33:10 UTC (rev 5947) +++ branches/1.2.x/numpy/ma/tests/test_core.py 2008-10-19 19:33:51 UTC (rev 5948) @@ -2270,6 +2270,21 @@ self.failUnless(c[0,0] is masked) self.failUnless(c.flags['C']) + + def test_make_mask_descr(self): + "Test make_mask_descr" + ntype = [('a',np.float), ('b',np.float)] + test = make_mask_descr(ntype) + assert_equal(test, [('a',np.bool),('b',np.bool)]) + # + ntype = (np.float, 2) + test = make_mask_descr(ntype) + assert_equal(test, (np.bool,2)) + # + ntype = np.float + test = make_mask_descr(ntype) + assert_equal(test, np.dtype(np.bool)) + #------------------------------------------------------------------------------ class TestMaskedFields(TestCase): @@ -2361,23 +2376,15 @@ a = array(iterator, dtype=[('a',float),('b',float)]) a.mask[0] = (1,0) controlmask = np.array([1]+19*[0], dtype=bool) - # + # Transform globally to simple dtype test = a.view(float) assert_equal(test, data.ravel()) assert_equal(test.mask, controlmask) - # + # Transform globally to dty test = a.view((float,2)) assert_equal(test, data) assert_equal(test.mask, controlmask.reshape(-1,2)) # - test = a.view([('A',float),('B',float)]) - assert_equal(test.mask.dtype.names, ('A', 'B')) - assert_equal(test['A'], a['a']) - assert_equal(test['B'], a['b']) - # - test = a.view(np.ndarray) - assert_equal(test, a._data) - # test = a.view((float,2), np.matrix) assert_equal(test, data) self.failUnless(isinstance(test, np.matrix)) @@ -2399,6 +2406,86 @@ assert_equal_records(a[-2]._data, a._data[-2]) assert_equal_records(a[-2]._mask, a._mask[-2]) + +class TestMaskedView(TestCase): + # + def setUp(self): + iterator = zip(np.arange(10), np.random.rand(10)) + data = np.array(iterator) + a = array(iterator, dtype=[('a',float),('b',float)]) + a.mask[0] = (1,0) + controlmask = np.array([1]+19*[0], dtype=bool) + self.data = (data, a, controlmask) + # + def test_view_to_nothing(self): + (data, a, controlmask) = self.data + test = a.view() + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test._data, a._data) + assert_equal(test._mask, a._mask) + + # + def test_view_to_type(self): + (data, a, controlmask) = self.data + test = a.view(np.ndarray) + self.failUnless(not isinstance(test, MaskedArray)) + assert_equal(test, a._data) + assert_equal_records(test, data.view(a.dtype).squeeze()) + # + def test_view_to_simple_dtype(self): + (data, a, controlmask) = self.data + # View globally + test = a.view(float) + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test, data.ravel()) + assert_equal(test.mask, controlmask) + # + def test_view_to_flexible_dtype(self): + (data, a, controlmask) = self.data + # + test = a.view([('A',float),('B',float)]) + assert_equal(test.mask.dtype.names, ('A', 'B')) + assert_equal(test['A'], a['a']) + assert_equal(test['B'], a['b']) + # + test = a[0].view([('A',float),('B',float)]) + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test.mask.dtype.names, ('A', 'B')) + assert_equal(test['A'], a['a'][0]) + assert_equal(test['B'], a['b'][0]) + # + test = a[-1].view([('A',float),('B',float)]) + self.failUnless(not isinstance(test, MaskedArray)) + assert_equal(test.dtype.names, ('A', 'B')) + assert_equal(test['A'], a['a'][-1]) + assert_equal(test['B'], a['b'][-1]) + + # + def test_view_to_subdtype(self): + (data, a, controlmask) = self.data + # View globally + test = a.view((float,2)) + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test, data) + assert_equal(test.mask, controlmask.reshape(-1,2)) + # View on 1 masked element + test = a[0].view((float,2)) + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test, data[0]) + assert_equal(test.mask, (1,0)) + # View on 1 unmasked element + test = a[-1].view((float,2)) + self.failUnless(not isinstance(test, MaskedArray)) + assert_equal(test, data[-1]) + # + def test_view_to_dtype_and_type(self): + (data, a, controlmask) = self.data + # + test = a.view((float,2), np.matrix) + assert_equal(test, data) + self.failUnless(isinstance(test, np.matrix)) + self.failUnless(not isinstance(test, MaskedArray)) + ############################################################################### #------------------------------------------------------------------------------ if __name__ == "__main__": From numpy-svn at scipy.org Sun Oct 19 19:37:07 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 19 Oct 2008 18:37:07 -0500 (CDT) Subject: [Numpy-svn] r5949 - trunk/numpy/ma Message-ID: <20081019233707.7410339C088@scipy.org> Author: pierregm Date: 2008-10-19 18:37:05 -0500 (Sun, 19 Oct 2008) New Revision: 5949 Modified: trunk/numpy/ma/mrecords.py Log: __getattribute__ : make sure than a np.void is returned when retrieving the unmasked attribute of a single record. Modified: trunk/numpy/ma/mrecords.py =================================================================== --- trunk/numpy/ma/mrecords.py 2008-10-19 19:33:51 UTC (rev 5948) +++ trunk/numpy/ma/mrecords.py 2008-10-19 23:37:05 UTC (rev 5949) @@ -199,25 +199,31 @@ if obj.dtype.fields: raise NotImplementedError("MaskedRecords is currently limited to"\ "simple records...") - obj = obj.view(MaskedArray) - obj._baseclass = ndarray - obj._isfield = True # Get some special attributes - _fill_value = _localdict.get('_fill_value', None) + # Reset the object's mask + hasmasked = False _mask = _localdict.get('_mask', None) - # Reset the object's mask if _mask is not None: try: - obj._mask = _mask[attr] + _mask = _mask[attr] except IndexError: # Couldn't find a mask: use the default (nomask) pass - # Reset the field values - if _fill_value is not None: - try: - obj._fill_value = _fill_value[attr] - except ValueError: - obj._fill_value = None + hasmasked = _mask.view((np.bool,(len(_mask.dtype) or 1))).any() + if (obj.shape or hasmasked): + obj = obj.view(MaskedArray) + obj._baseclass = ndarray + obj._isfield = True + obj._mask = _mask + # Reset the field values + _fill_value = _localdict.get('_fill_value', None) + if _fill_value is not None: + try: + obj._fill_value = _fill_value[attr] + except ValueError: + obj._fill_value = None + else: + obj = obj.item() return obj From numpy-svn at scipy.org Mon Oct 20 17:01:54 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 20 Oct 2008 16:01:54 -0500 (CDT) Subject: [Numpy-svn] r5950 - in trunk/numpy/core: . code_generators src tests Message-ID: <20081020210154.BAADC39C088@scipy.org> Author: stefan Date: 2008-10-20 16:00:56 -0500 (Mon, 20 Oct 2008) New Revision: 5950 Added: trunk/numpy/core/src/umath_tests.c.src Modified: trunk/numpy/core/code_generators/ufunc_api_order.txt trunk/numpy/core/setup.py trunk/numpy/core/tests/test_ufunc.py Log: Merge generalised ufuncs branch. Modified: trunk/numpy/core/code_generators/ufunc_api_order.txt =================================================================== --- trunk/numpy/core/code_generators/ufunc_api_order.txt 2008-10-19 23:37:05 UTC (rev 5949) +++ trunk/numpy/core/code_generators/ufunc_api_order.txt 2008-10-20 21:00:56 UTC (rev 5950) @@ -31,3 +31,4 @@ PyUFunc_getfperr PyUFunc_handlefperr PyUFunc_ReplaceLoopBySignature +PyUFunc_FromFuncAndDataAndSignature Modified: trunk/numpy/core/setup.py =================================================================== --- trunk/numpy/core/setup.py 2008-10-19 23:37:05 UTC (rev 5949) +++ trunk/numpy/core/setup.py 2008-10-20 21:00:56 UTC (rev 5950) @@ -399,7 +399,15 @@ extra_info = blas_info ) + config.add_extension('umath_tests', + sources = [join('src','umath_tests.c.src'), + ], + depends = [join('blasdot','cblas.h'),] + deps, + include_dirs = ['blasdot'], + extra_info = blas_info + ) + config.add_data_dir('tests') config.add_data_dir('tests/data') Copied: trunk/numpy/core/src/umath_tests.c.src (from rev 5949, branches/gen_ufuncs/numpy/core/src/umath_tests.c.src) Modified: trunk/numpy/core/tests/test_ufunc.py =================================================================== --- trunk/numpy/core/tests/test_ufunc.py 2008-10-19 23:37:05 UTC (rev 5949) +++ trunk/numpy/core/tests/test_ufunc.py 2008-10-20 21:00:56 UTC (rev 5950) @@ -1,5 +1,7 @@ import numpy as np from numpy.testing import * +from numpy.random import rand +import numpy.core.umath_tests as umt class TestUfunc(TestCase): def test_reduceat_shifting_sum(self) : @@ -230,6 +232,68 @@ """ pass + def test_innerwt(self): + a = np.arange(6).reshape((2,3)) + b = np.arange(10,16).reshape((2,3)) + w = np.arange(20,26).reshape((2,3)) + assert_array_equal(umt.innerwt(a,b,w), np.sum(a*b*w,axis=-1)) + a = np.arange(100,124).reshape((2,3,4)) + b = np.arange(200,224).reshape((2,3,4)) + w = np.arange(300,324).reshape((2,3,4)) + assert_array_equal(umt.innerwt(a,b,w), np.sum(a*b*w,axis=-1)) + def test_matrix_multiply(self): + self.compare_matrix_multiply_results(np.long) + self.compare_matrix_multiply_results(np.double) + + def compare_matrix_multiply_results(self, tp): + d1 = np.array(rand(2,3,4), dtype=tp) + d2 = np.array(rand(2,3,4), dtype=tp) + msg = "matrix multiply on type %s" % d1.dtype.name + + def permute_n(n): + if n == 1: + return ([0],) + ret = () + base = permute_n(n-1) + for perm in base: + for i in xrange(n): + new = perm + [n-1] + new[n-1] = new[i] + new[i] = n-1 + ret += (new,) + return ret + def slice_n(n): + if n == 0: + return ((),) + ret = () + base = slice_n(n-1) + for sl in base: + ret += (sl+(slice(None),),) + ret += (sl+(slice(0,1),),) + return ret + def broadcastable(s1,s2): + return s1 == s2 or s1 == 1 or s2 == 1 + permute_3 = permute_n(3) + slice_3 = slice_n(3) + ((slice(None,None,-1),)*3,) + + ref = True + for p1 in permute_3: + for p2 in permute_3: + for s1 in slice_3: + for s2 in slice_3: + a1 = d1.transpose(p1)[s1] + a2 = d2.transpose(p2)[s2] + ref = ref and a1.base != None and a1.base.base != None + ref = ref and a2.base != None and a2.base.base != None + if broadcastable(a1.shape[-1], a2.shape[-2]) and \ + broadcastable(a1.shape[0], a2.shape[0]): + assert_array_almost_equal(umt.matrix_multiply(a1,a2), \ + np.sum(a2[...,np.newaxis].swapaxes(-3,-1) * \ + a1[...,np.newaxis,:], axis=-1), \ + err_msg = msg+' %s %s' % (str(a1.shape),str(a2.shape))) + + assert_equal(ref, True, err_msg="reference check") + if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Mon Oct 20 17:57:43 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 20 Oct 2008 16:57:43 -0500 (CDT) Subject: [Numpy-svn] r5951 - in trunk/numpy/core: . code_generators src tests Message-ID: <20081020215743.381A439C088@scipy.org> Author: stefan Date: 2008-10-20 16:57:01 -0500 (Mon, 20 Oct 2008) New Revision: 5951 Removed: trunk/numpy/core/src/umath_tests.c.src Modified: trunk/numpy/core/code_generators/ufunc_api_order.txt trunk/numpy/core/setup.py trunk/numpy/core/tests/test_ufunc.py Log: Revert merge. Modified: trunk/numpy/core/code_generators/ufunc_api_order.txt =================================================================== --- trunk/numpy/core/code_generators/ufunc_api_order.txt 2008-10-20 21:00:56 UTC (rev 5950) +++ trunk/numpy/core/code_generators/ufunc_api_order.txt 2008-10-20 21:57:01 UTC (rev 5951) @@ -31,4 +31,3 @@ PyUFunc_getfperr PyUFunc_handlefperr PyUFunc_ReplaceLoopBySignature -PyUFunc_FromFuncAndDataAndSignature Modified: trunk/numpy/core/setup.py =================================================================== --- trunk/numpy/core/setup.py 2008-10-20 21:00:56 UTC (rev 5950) +++ trunk/numpy/core/setup.py 2008-10-20 21:57:01 UTC (rev 5951) @@ -399,15 +399,7 @@ extra_info = blas_info ) - config.add_extension('umath_tests', - sources = [join('src','umath_tests.c.src'), - ], - depends = [join('blasdot','cblas.h'),] + deps, - include_dirs = ['blasdot'], - extra_info = blas_info - ) - config.add_data_dir('tests') config.add_data_dir('tests/data') Deleted: trunk/numpy/core/src/umath_tests.c.src =================================================================== --- trunk/numpy/core/src/umath_tests.c.src 2008-10-20 21:00:56 UTC (rev 5950) +++ trunk/numpy/core/src/umath_tests.c.src 2008-10-20 21:57:01 UTC (rev 5951) @@ -1,417 +0,0 @@ -/* -*- c -*- */ - -/* - ***************************************************************************** - ** INCLUDES ** - ***************************************************************************** - */ -#include -#include -#include - -#ifndef CBLAS_HEADER -#define CBLAS_HEADER "cblas.h" -#endif -#include CBLAS_HEADER - -/* - ***************************************************************************** - ** BASICS ** - ***************************************************************************** - */ - -typedef npy_intp intp; - -#define INIT_OUTER_LOOP_1 \ - intp dN = *dimensions++; \ - intp N_; \ - intp s0 = *steps++; - -#define INIT_OUTER_LOOP_2 \ - INIT_OUTER_LOOP_1 \ - intp s1 = *steps++; - -#define INIT_OUTER_LOOP_3 \ - INIT_OUTER_LOOP_2 \ - intp s2 = *steps++; - -#define INIT_OUTER_LOOP_4 \ - INIT_OUTER_LOOP_3 \ - intp s3 = *steps++; - -#define BEGIN_OUTER_LOOP_3 \ - for (N_ = 0; N_ < dN; N_++, args[0] += s0, args[1] += s1, args[2] += s2) { - -#define BEGIN_OUTER_LOOP_4 \ - for (N_ = 0; N_ < dN; N_++, args[0] += s0, args[1] += s1, args[2] += s2, args[3] += s3) { - -#define END_OUTER_LOOP } - - -/* - ***************************************************************************** - ** UFUNC LOOPS ** - ***************************************************************************** - */ - -char *inner1d_signature = "(i),(i)->()"; - -/**begin repeat - - #TYPE=LONG,DOUBLE# - #typ=npy_long, npy_double# -*/ - -/* - * This implements the function - * out[n] = sum_i { in1[n, i] * in2[n, i] }. - */ -static void - at TYPE@_inner1d(char **args, intp *dimensions, intp *steps, void *func) -{ - INIT_OUTER_LOOP_3 - intp di = dimensions[0]; - intp i; - intp is1=steps[0], is2=steps[1]; - BEGIN_OUTER_LOOP_3 - char *ip1=args[0], *ip2=args[1], *op=args[2]; - @typ@ sum = 0; - for (i = 0; i < di; i++) { - sum += (*(@typ@ *)ip1) * (*(@typ@ *)ip2); - ip1 += is1; - ip2 += is2; - } - *(@typ@ *)op = sum; - END_OUTER_LOOP -} - -/**end repeat**/ - -char *innerwt_signature = "(i),(i),(i)->()"; - -/**begin repeat - - #TYPE=LONG,DOUBLE# - #typ=npy_long, npy_double# -*/ - - -/* - * This implements the function - * out[n] = sum_i { in1[n, i] * in2[n, i] * in3[n, i] }. - */ - -static void - at TYPE@_innerwt(char **args, intp *dimensions, intp *steps, void *func) -{ - INIT_OUTER_LOOP_4 - intp di = dimensions[0]; - intp i; - intp is1=steps[0], is2=steps[1], is3=steps[2]; - BEGIN_OUTER_LOOP_4 - char *ip1=args[0], *ip2=args[1], *ip3=args[2], *op=args[3]; - @typ@ sum = 0; - for (i = 0; i < di; i++) { - sum += (*(@typ@ *)ip1) * (*(@typ@ *)ip2) * (*(@typ@ *)ip3); - ip1 += is1; - ip2 += is2; - ip3 += is3; - } - *(@typ@ *)op = sum; - END_OUTER_LOOP -} - -/**end repeat**/ - -char *matrix_multiply_signature = "(m,n),(n,p)->(m,p)"; - -/**begin repeat - - #TYPE=LONG# - #typ=npy_long# -*/ - -/* - * This implements the function - * out[k, m, p] = sum_n { in1[k, m, n] * in2[k, n, p] }. - */ - - -static void - at TYPE@_matrix_multiply(char **args, intp *dimensions, intp *steps, void *func) -{ - /* no BLAS is available */ - INIT_OUTER_LOOP_3 - intp dm = dimensions[0]; - intp dn = dimensions[1]; - intp dp = dimensions[2]; - intp m,n,p; - intp is1_m=steps[0], is1_n=steps[1], is2_n=steps[2], is2_p=steps[3], - os_m=steps[4], os_p=steps[5]; - intp ib1_n = is1_n*dn; - intp ib2_n = is2_n*dn; - intp ib2_p = is2_p*dp; - intp ob_p = os_p *dp; - BEGIN_OUTER_LOOP_3 - char *ip1=args[0], *ip2=args[1], *op=args[2]; - for (m = 0; m < dm; m++) { - for (n = 0; n < dn; n++) { - register @typ@ val1 = (*(@typ@ *)ip1); - for (p = 0; p < dp; p++) { - if (n == 0) *(@typ@ *)op = 0; - *(@typ@ *)op += val1 * (*(@typ@ *)ip2); - ip2 += is2_p; - op += os_p; - } - ip2 -= ib2_p; - op -= ob_p; - ip1 += is1_n; - ip2 += is2_n; - } - ip1 -= ib1_n; - ip2 -= ib2_n; - ip1 += is1_m; - op += os_m; - } - END_OUTER_LOOP -} - -/**end repeat**/ - -/**begin repeat - - #TYPE=FLOAT,DOUBLE# - #B_TYPE=s, d# - #typ=npy_float, npy_double# -*/ - -static void - at TYPE@_matrix_multiply(char **args, intp *dimensions, intp *steps, void *func) -{ - INIT_OUTER_LOOP_3 - intp dm = dimensions[0]; - intp dn = dimensions[1]; - intp dp = dimensions[2]; - intp m,n,p; - intp is1_m=steps[0], is1_n=steps[1], is2_n=steps[2], is2_p=steps[3], - os_m=steps[4], os_p=steps[5]; - intp ib1_n = is1_n*dn; - intp ib2_n = is2_n*dn; - intp ib2_p = is2_p*dp; - intp ob_p = os_p *dp; - - enum CBLAS_ORDER Order = CblasRowMajor; - enum CBLAS_TRANSPOSE Trans1, Trans2; - int M, N, L; - int lda, ldb, ldc; - int typeSize = sizeof(@typ@); - - /* - * BLAS requires each array to have contiguous memory layout on one - * dimension and a positive stride for the other dimension. - */ - if (is1_m <= 0 || is1_n <= 0 || is2_n <= 0 || is2_p <= 0) - goto no_blas; - - if (is1_n == typeSize && is1_m % typeSize == 0) { - Trans1 = CblasNoTrans; - lda = is1_m / typeSize; - } - else if (is1_m == typeSize && is1_n % typeSize == 0) { - Trans1 = CblasTrans; - lda = is1_n / typeSize; - } - else { - goto no_blas; - } - - if (is2_p == typeSize && is2_n % typeSize == 0) { - Trans2 = CblasNoTrans; - ldb = is2_n / typeSize; - } - else if (is2_n == typeSize && is2_p % typeSize == 0) { - Trans2 = CblasTrans; - ldb = is2_p / typeSize; - } - else { - goto no_blas; - } - - M = dm; - N = dp; - L = dn; - if (os_p == typeSize && os_m % typeSize == 0) { - ldc = os_m / typeSize; - BEGIN_OUTER_LOOP_3 - cblas_ at B_TYPE@gemm(Order, Trans1, Trans2, - M, N, L, - 1.0, (@typ@*)args[0], lda, - (@typ@*)args[1], ldb, - 0.0, (@typ@*)args[2], ldc); - END_OUTER_LOOP - return; - } - else if (os_m == typeSize && os_p % typeSize == 0) { - enum CBLAS_TRANSPOSE Trans1r, Trans2r; - ldc = os_p / typeSize; - Trans1r = (Trans1 == CblasTrans) ? CblasNoTrans : CblasTrans; - Trans2r = (Trans2 == CblasTrans) ? CblasNoTrans : CblasTrans; - BEGIN_OUTER_LOOP_3 - /* compute C^T = B^T * A^T */ - cblas_ at B_TYPE@gemm(Order, Trans2r, Trans1r, - N, M, L, - 1.0, (@typ@*)args[1], ldb, - (@typ@*)args[0], lda, - 0.0, (@typ@*)args[2], ldc); - END_OUTER_LOOP - return; - } - - -no_blas: - BEGIN_OUTER_LOOP_3 - char *ip1=args[0], *ip2=args[1], *op=args[2]; - for (m = 0; m < dm; m++) { - for (n = 0; n < dn; n++) { - register @typ@ val1 = (*(@typ@ *)ip1); - for (p = 0; p < dp; p++) { - if (n == 0) *(@typ@ *)op = 0; - *(@typ@ *)op += val1 * (*(@typ@ *)ip2); - ip2 += is2_p; - op += os_p; - } - ip2 -= ib2_p; - op -= ob_p; - ip1 += is1_n; - ip2 += is2_n; - } - ip1 -= ib1_n; - ip2 -= ib2_n; - ip1 += is1_m; - op += os_m; - } - END_OUTER_LOOP -} - -/**end repeat**/ - -/* The following lines were generated using a slightly modified - version of code_generators/generate_umath.py and adding these - lines to defdict: - -defdict = { -'inner1d' : - Ufunc(2, 1, None_, - r'''inner on the last dimension and broadcast on the rest \n" - " \"(i),(i)->()\" \n''', - TD('ld'), - ), -'innerwt' : - Ufunc(3, 1, None_, - r'''inner1d with a weight argument \n" - " \"(i),(i),(i)->()\" \n''', - TD('ld'), - ), -} - -*/ - -static PyUFuncGenericFunction inner1d_functions[] = { LONG_inner1d, DOUBLE_inner1d }; -static void * inner1d_data[] = { (void *)NULL, (void *)NULL }; -static char inner1d_signatures[] = { PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE }; -static PyUFuncGenericFunction innerwt_functions[] = { LONG_innerwt, DOUBLE_innerwt }; -static void * innerwt_data[] = { (void *)NULL, (void *)NULL }; -static char innerwt_signatures[] = { PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE }; -static PyUFuncGenericFunction matrix_multiply_functions[] = { LONG_matrix_multiply, FLOAT_matrix_multiply, DOUBLE_matrix_multiply }; -static void *matrix_multiply_data[] = { (void *)NULL, (void *)NULL, (void *)NULL }; -static char matrix_multiply_signatures[] = { PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE }; - -static void -addUfuncs(PyObject *dictionary) { - PyObject *f; - - f = PyUFunc_FromFuncAndDataAndSignature(inner1d_functions, inner1d_data, inner1d_signatures, 2, - 2, 1, PyUFunc_None, "inner1d", - "inner on the last dimension and broadcast on the rest \n"\ - " \"(i),(i)->()\" \n", - 0, inner1d_signature); - PyDict_SetItemString(dictionary, "inner1d", f); - Py_DECREF(f); - f = PyUFunc_FromFuncAndDataAndSignature(innerwt_functions, innerwt_data, innerwt_signatures, 2, - 3, 1, PyUFunc_None, "innerwt", - "inner1d with a weight argument \n"\ - " \"(i),(i),(i)->()\" \n", - 0, innerwt_signature); - PyDict_SetItemString(dictionary, "innerwt", f); - Py_DECREF(f); - f = PyUFunc_FromFuncAndDataAndSignature(matrix_multiply_functions, - matrix_multiply_data, matrix_multiply_signatures, - 3, 2, 1, PyUFunc_None, "matrix_multiply", - "matrix multiplication on last two dimensions \n"\ - " \"(m,n),(n,p)->(m,p)\" \n", - 0, matrix_multiply_signature); - PyDict_SetItemString(dictionary, "matrix_multiply", f); - Py_DECREF(f); -} - -/* - End of auto-generated code. -*/ - - - -static PyObject * -UMath_Tests_test_signature(PyObject *dummy, PyObject *args) -{ - int nin, nout; - PyObject *signature; - PyObject *f; - int core_enabled; - - if (!PyArg_ParseTuple(args, "iiO", &nin, &nout, &signature)) return NULL; - f = PyUFunc_FromFuncAndDataAndSignature(NULL, NULL, NULL, - 0, nin, nout, PyUFunc_None, "no name", - "doc:none", - 1, PyString_AS_STRING(signature)); - if (f == NULL) return NULL; - core_enabled = ((PyUFuncObject*)f)->core_enabled; - return Py_BuildValue("i", core_enabled); -} - -static PyMethodDef UMath_TestsMethods[] = { - {"test_signature", UMath_Tests_test_signature, METH_VARARGS, - "Test signature parsing of ufunc. \n" - "Arguments: nin nout signature \n" - "If fails, it returns NULL. Otherwise it will returns 0 for scalar ufunc " - "and 1 for generalized ufunc. \n", - }, - {NULL, NULL, 0, NULL} /* Sentinel */ -}; - -PyMODINIT_FUNC -initumath_tests(void) -{ - PyObject *m; - PyObject *d; - PyObject *version; - - m = Py_InitModule("umath_tests", UMath_TestsMethods); - if (m == NULL) return; - - import_array(); - import_ufunc(); - - d = PyModule_GetDict(m); - - version = PyString_FromString("0.1"); - PyDict_SetItemString(d, "__version__", version); - Py_DECREF(version); - - /* Load the ufunc operators into the module's namespace */ - addUfuncs(d); - - if (PyErr_Occurred()) { - PyErr_SetString(PyExc_RuntimeError, - "cannot load umath_tests module."); - } -} Modified: trunk/numpy/core/tests/test_ufunc.py =================================================================== --- trunk/numpy/core/tests/test_ufunc.py 2008-10-20 21:00:56 UTC (rev 5950) +++ trunk/numpy/core/tests/test_ufunc.py 2008-10-20 21:57:01 UTC (rev 5951) @@ -1,7 +1,5 @@ import numpy as np from numpy.testing import * -from numpy.random import rand -import numpy.core.umath_tests as umt class TestUfunc(TestCase): def test_reduceat_shifting_sum(self) : @@ -232,68 +230,6 @@ """ pass - def test_innerwt(self): - a = np.arange(6).reshape((2,3)) - b = np.arange(10,16).reshape((2,3)) - w = np.arange(20,26).reshape((2,3)) - assert_array_equal(umt.innerwt(a,b,w), np.sum(a*b*w,axis=-1)) - a = np.arange(100,124).reshape((2,3,4)) - b = np.arange(200,224).reshape((2,3,4)) - w = np.arange(300,324).reshape((2,3,4)) - assert_array_equal(umt.innerwt(a,b,w), np.sum(a*b*w,axis=-1)) - def test_matrix_multiply(self): - self.compare_matrix_multiply_results(np.long) - self.compare_matrix_multiply_results(np.double) - - def compare_matrix_multiply_results(self, tp): - d1 = np.array(rand(2,3,4), dtype=tp) - d2 = np.array(rand(2,3,4), dtype=tp) - msg = "matrix multiply on type %s" % d1.dtype.name - - def permute_n(n): - if n == 1: - return ([0],) - ret = () - base = permute_n(n-1) - for perm in base: - for i in xrange(n): - new = perm + [n-1] - new[n-1] = new[i] - new[i] = n-1 - ret += (new,) - return ret - def slice_n(n): - if n == 0: - return ((),) - ret = () - base = slice_n(n-1) - for sl in base: - ret += (sl+(slice(None),),) - ret += (sl+(slice(0,1),),) - return ret - def broadcastable(s1,s2): - return s1 == s2 or s1 == 1 or s2 == 1 - permute_3 = permute_n(3) - slice_3 = slice_n(3) + ((slice(None,None,-1),)*3,) - - ref = True - for p1 in permute_3: - for p2 in permute_3: - for s1 in slice_3: - for s2 in slice_3: - a1 = d1.transpose(p1)[s1] - a2 = d2.transpose(p2)[s2] - ref = ref and a1.base != None and a1.base.base != None - ref = ref and a2.base != None and a2.base.base != None - if broadcastable(a1.shape[-1], a2.shape[-2]) and \ - broadcastable(a1.shape[0], a2.shape[0]): - assert_array_almost_equal(umt.matrix_multiply(a1,a2), \ - np.sum(a2[...,np.newaxis].swapaxes(-3,-1) * \ - a1[...,np.newaxis,:], axis=-1), \ - err_msg = msg+' %s %s' % (str(a1.shape),str(a2.shape))) - - assert_equal(ref, True, err_msg="reference check") - if __name__ == "__main__": run_module_suite() From numpy-svn at scipy.org Mon Oct 20 22:48:54 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 20 Oct 2008 21:48:54 -0500 (CDT) Subject: [Numpy-svn] r5952 - in branches/ufunc_cleanup/numpy: core/blasdot core/code_generators core/include/numpy core/src fft lib/src linalg ma ma/tests numarray testing Message-ID: <20081021024854.F11CA39C0F1@scipy.org> Author: charris Date: 2008-10-20 21:48:38 -0500 (Mon, 20 Oct 2008) New Revision: 5952 Added: branches/ufunc_cleanup/numpy/core/include/numpy/utils.h Removed: branches/ufunc_cleanup/numpy/core/include/numpy/WTF_MathExtras.h Modified: branches/ufunc_cleanup/numpy/core/blasdot/_dotblas.c branches/ufunc_cleanup/numpy/core/code_generators/generate_umath.py branches/ufunc_cleanup/numpy/core/include/numpy/ndarrayobject.h branches/ufunc_cleanup/numpy/core/src/_sortmodule.c.src branches/ufunc_cleanup/numpy/core/src/arraymethods.c branches/ufunc_cleanup/numpy/core/src/arrayobject.c branches/ufunc_cleanup/numpy/core/src/arraytypes.inc.src branches/ufunc_cleanup/numpy/core/src/math_c99.inc.src branches/ufunc_cleanup/numpy/core/src/multiarraymodule.c branches/ufunc_cleanup/numpy/core/src/scalarmathmodule.c.src branches/ufunc_cleanup/numpy/core/src/scalartypes.inc.src branches/ufunc_cleanup/numpy/core/src/ufuncobject.c branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src branches/ufunc_cleanup/numpy/fft/fftpack_litemodule.c branches/ufunc_cleanup/numpy/lib/src/_compiled_base.c branches/ufunc_cleanup/numpy/linalg/lapack_litemodule.c branches/ufunc_cleanup/numpy/ma/core.py branches/ufunc_cleanup/numpy/ma/mrecords.py branches/ufunc_cleanup/numpy/ma/tests/test_core.py branches/ufunc_cleanup/numpy/ma/tests/test_mrecords.py branches/ufunc_cleanup/numpy/ma/tests/test_subclassing.py branches/ufunc_cleanup/numpy/numarray/_capi.c branches/ufunc_cleanup/numpy/testing/utils.py Log: Merge up to r5951 of trunk. Modified: branches/ufunc_cleanup/numpy/core/blasdot/_dotblas.c =================================================================== --- branches/ufunc_cleanup/numpy/core/blasdot/_dotblas.c 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/core/blasdot/_dotblas.c 2008-10-21 02:48:38 UTC (rev 5952) @@ -80,7 +80,7 @@ static char doc_alterdot[] = "alterdot() changes all dot functions to use blas."; static PyObject * -dotblas_alterdot(PyObject *dummy, PyObject *args) +dotblas_alterdot(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyArray_Descr *descr; @@ -115,7 +115,7 @@ static char doc_restoredot[] = "restoredot() restores dots to defaults."; static PyObject * -dotblas_restoredot(PyObject *dummy, PyObject *args) +dotblas_restoredot(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyArray_Descr *descr; @@ -203,7 +203,7 @@ "dimension of b.\nNB: The first argument is not conjugated."; static PyObject * -dotblas_matrixproduct(PyObject *dummy, PyObject *args) +dotblas_matrixproduct(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *op1, *op2; PyArrayObject *ap1 = NULL, *ap2 = NULL, *ret = NULL; @@ -798,7 +798,7 @@ "not conjugated."; static PyObject * -dotblas_innerproduct(PyObject *dummy, PyObject *args) +dotblas_innerproduct(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *op1, *op2; PyArrayObject *ap1, *ap2, *ret; @@ -1046,7 +1046,7 @@ static char doc_vdot[] = "vdot(a,b)\nReturns the dot product of a and b for scalars and vectors\nof floating point and complex types. The first argument, a, is conjugated."; -static PyObject *dotblas_vdot(PyObject *dummy, PyObject *args) { +static PyObject *dotblas_vdot(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *op1, *op2; PyArrayObject *ap1=NULL, *ap2=NULL, *ret=NULL; int l; Modified: branches/ufunc_cleanup/numpy/core/code_generators/generate_umath.py =================================================================== --- branches/ufunc_cleanup/numpy/core/code_generators/generate_umath.py 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/core/code_generators/generate_umath.py 2008-10-21 02:48:38 UTC (rev 5952) @@ -316,16 +316,6 @@ TD(noobj), TD(O, f='_npy_ObjectMin') ), -'fmax' : - Ufunc(2, 1, None, - "", - TD(inexact) - ), -'fmin' : - Ufunc(2, 1, None, - "", - TD(inexact) - ), 'bitwise_and' : Ufunc(2, 1, One, docstrings.get('numpy.core.umath.bitwise_and'), Deleted: branches/ufunc_cleanup/numpy/core/include/numpy/WTF_MathExtras.h =================================================================== --- branches/ufunc_cleanup/numpy/core/include/numpy/WTF_MathExtras.h 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/core/include/numpy/WTF_MathExtras.h 2008-10-21 02:48:38 UTC (rev 5952) @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple Inc. 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. - */ - - -#ifndef WTF_MathExtras_h -#define WTF_MathExtras_h - -#include -#include -#include - -#if defined (__SVR4) && defined (__sun) && defined (__GNUC__) - -#include - -#endif - -#if defined(_MSC_VER) - -#include -#include - -#if HAVE(FLOAT_H) -#include -#endif - -#endif - -#ifndef M_PI -const double piDouble = 3.14159265358979323846; -const float piFloat = 3.14159265358979323846f; -#else -const double piDouble = M_PI; -const float piFloat = (float)M_PI; -#endif - -#ifndef M_PI_4 -const double piOverFourDouble = 0.785398163397448309616; -const float piOverFourFloat = 0.785398163397448309616f; -#else -const double piOverFourDouble = M_PI_4; -const float piOverFourFloat = (float)M_PI_4; -#endif - -#if defined (__SVR4) && defined (__sun) && defined (__GNUC__) - -#ifndef isfinite -#define isfinite(x) (finite(x) && !isnand(x)) -#endif -#ifndef isinf -#define isinf(x) (!finite(x) && !isnand(x)) -#endif -#ifndef signbit -#define signbit(x) (x < 0.0) /* FIXME: Wrong for negative 0. */ -#endif - -#endif - -#if defined(_MSC_VER) - -#define isinf(num) ( !_finite(num) && !_isnan(num) ) -#define isnan(num) ( !!_isnan(num) ) -/* -#define lround(num) ( (long)(num > 0 ? num + 0.5 : ceil(num - 0.5)) ) -#define lroundf(num) ( (long)(num > 0 ? num + 0.5f : ceilf(num - 0.5f)) ) -#define round(num) ( num > 0 ? floor(num + 0.5) : ceil(num - 0.5) ) -#define roundf(num) ( num > 0 ? floorf(num + 0.5f) : ceilf(num - 0.5f) ) -*/ -#define signbit(num) ( _copysign(1.0, num) < 0 ) -#define trunc(num) ( num > 0 ? floor(num) : ceil(num) ) -#define nextafter(x, y) ( _nextafter(x, y) ) -#define nextafterf(x, y) ( x > y ? x - FLT_EPSILON : x + FLT_EPSILON ) -#define copysign(x, y) ( _copysign(x, y) ) -#define isfinite(x) ( _finite(x) ) - -/* - * Work around a bug in Win, where atan2(+-infinity, +-infinity) - * yields NaN instead of specific values. - */ -/* -double -wtf_atan2(double x, double y) -{ - static double posInf = std::numeric_limits::infinity(); - static double negInf = -std::numeric_limits::infinity(); - static double nan = std::numeric_limits::quiet_NaN(); - - - double result = nan; - - if (x == posInf && y == posInf) - result = piOverFourDouble; - else if (x == posInf && y == negInf) - result = 3 * piOverFourDouble; - else if (x == negInf && y == posInf) - - result = -piOverFourDouble; - else if (x == negInf && y == negInf) - result = -3 * piOverFourDouble; - else - result = ::atan2(x, y); - - return result; -} -*/ - -/* - * Work around a bug in the Microsoft CRT, where fmod(x, +-infinity) - * yields NaN instead of x. - */ -#define wtf_fmod(x, y) ( (!isinf(x) && isinf(y)) ? x : fmod(x, y) ) - -/* - * Work around a bug in the Microsoft CRT, where pow(NaN, 0) - * yields NaN instead of 1. - */ -#define wtf_pow(x, y) ( y == 0 ? 1 : pow(x, y) ) - -/* -#define atan2(x, y) wtf_atan2(x, y) -*/ -#define fmod(x, y) wtf_fmod(x, y) -#define pow(x, y) wtf_pow(x, y) - -#endif /* COMPILER(MSVC) */ - - -#define deg2rad(d) ( d * piDouble / 180.0 ) -#define rad2deg(r) ( r * 180.0 / piDouble ) -#define deg2grad(d) ( d * 400.0 / 360.0 ) -#define grad2deg(g) ( g * 360.0 / 400.0 ) -#define rad2grad(r) ( r * 200.0 / piDouble ) -#define grad2rad(g) ( g * piDouble / 200.0 ) - -#define deg2radf(d) ( d * piFloat / 180.0f ) -#define rad2degf(r) ( r * 180.0f / piFloat ) -#define deg2gradf(d) ( d * 400.0f / 360.0f ) -#define grad2degf(g) ( g * 360.0f / 400.0f ) -#define rad2gradf(r) ( r * 200.0f / piFloat ) -#define grad2radf(g) ( g * piFloat / 200.0f ) - - -#endif /* #ifndef WTF_MathExtras_h */ Modified: branches/ufunc_cleanup/numpy/core/include/numpy/ndarrayobject.h =================================================================== --- branches/ufunc_cleanup/numpy/core/include/numpy/ndarrayobject.h 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/core/include/numpy/ndarrayobject.h 2008-10-21 02:48:38 UTC (rev 5952) @@ -23,6 +23,8 @@ #define NPY_ALLOW_THREADS 0 #endif +#include "utils.h" + /* There are several places in the code where an array of dimensions is * allocated statically. This is the size of that static allocation. * Copied: branches/ufunc_cleanup/numpy/core/include/numpy/utils.h (from rev 5951, trunk/numpy/core/include/numpy/utils.h) Modified: branches/ufunc_cleanup/numpy/core/src/_sortmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/_sortmodule.c.src 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/core/src/_sortmodule.c.src 2008-10-21 02:48:38 UTC (rev 5952) @@ -54,7 +54,7 @@ #lessequal=STDC_LE*14,NUMC_LE*3# **/ static int - at TYPE@_quicksort(@type@ *start, intp num, void *unused) + at TYPE@_quicksort(@type@ *start, intp num, void * NPY_UNUSED(unused)) { @type@ *pl = start; @type@ *pr = start + num - 1; @@ -112,7 +112,7 @@ } static int - at TYPE@_aquicksort(@type@ *v, intp* tosort, intp num, void *unused) + at TYPE@_aquicksort(@type@ *v, intp* tosort, intp num, void *NPY_UNUSED(unused)) { @type@ vp; intp *pl, *pr, SWAP_temp; @@ -174,7 +174,7 @@ static int - at TYPE@_heapsort(@type@ *start, intp n, void *unused) + at TYPE@_heapsort(@type@ *start, intp n, void *NPY_UNUSED(unused)) { @type@ tmp, *a; intp i,j,l; @@ -220,7 +220,7 @@ } static int - at TYPE@_aheapsort(@type@ *v, intp *tosort, intp n, void *unused) + at TYPE@_aheapsort(@type@ *v, intp *tosort, intp n, void *NPY_UNUSED(unused)) { intp *a, i,j,l, tmp; /* The arrays need to be offset by one for heapsort indexing */ @@ -306,7 +306,7 @@ } static int - at TYPE@_mergesort(@type@ *start, intp num, void *unused) + at TYPE@_mergesort(@type@ *start, intp num, void *NPY_UNUSED(unused)) { @type@ *pl, *pr, *pw; @@ -365,7 +365,7 @@ } static int - at TYPE@_amergesort(@type@ *v, intp *tosort, intp num, void *unused) + at TYPE@_amergesort(@type@ *v, intp *tosort, intp num, void *NPY_UNUSED(unused)) { intp *pl, *pr, *pw; Modified: branches/ufunc_cleanup/numpy/core/src/arraymethods.c =================================================================== --- branches/ufunc_cleanup/numpy/core/src/arraymethods.c 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/core/src/arraymethods.c 2008-10-21 02:48:38 UTC (rev 5952) @@ -1105,7 +1105,7 @@ static PyObject * -array_reduce(PyArrayObject *self, PyObject *args) +array_reduce(PyArrayObject *self, PyObject *NPY_UNUSED(args)) { /* version number of this pickle type. Increment if we need to change the format. Be sure to handle the old versions in @@ -2021,7 +2021,7 @@ METH_VARARGS | METH_KEYWORDS, NULL}, {"view", (PyCFunction)array_view, METH_VARARGS | METH_KEYWORDS, NULL}, - {NULL, NULL} /* sentinel */ + {NULL, NULL, 0, NULL} /* sentinel */ }; #undef _ARET Modified: branches/ufunc_cleanup/numpy/core/src/arrayobject.c =================================================================== --- branches/ufunc_cleanup/numpy/core/src/arrayobject.c 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/core/src/arrayobject.c 2008-10-21 02:48:38 UTC (rev 5952) @@ -3710,7 +3710,7 @@ } static PyObject * -array_power(PyArrayObject *a1, PyObject *o2, PyObject *modulo) +array_power(PyArrayObject *a1, PyObject *o2, PyObject *NPY_UNUSED(modulo)) { /* modulo is ignored! */ PyObject *value; @@ -3801,7 +3801,7 @@ } static PyObject * -array_inplace_power(PyArrayObject *a1, PyObject *o2, PyObject *modulo) +array_inplace_power(PyArrayObject *a1, PyObject *o2, PyObject *NPY_UNUSED(modulo)) { /* modulo is ignored! */ PyObject *value; @@ -6871,7 +6871,7 @@ --- default sub-class behavior */ static PyObject * -array_finalize_get(PyArrayObject *self) +array_finalize_get(PyArrayObject *NPY_UNUSED(self)) { Py_INCREF(Py_None); return Py_None; @@ -6880,76 +6880,76 @@ static PyGetSetDef array_getsetlist[] = { {"ndim", (getter)array_ndim_get, - NULL, NULL}, + NULL, NULL, NULL}, {"flags", (getter)array_flags_get, - NULL, NULL}, + NULL, NULL, NULL}, {"shape", (getter)array_shape_get, (setter)array_shape_set, - NULL}, + NULL, NULL}, {"strides", (getter)array_strides_get, (setter)array_strides_set, - NULL}, + NULL, NULL}, {"data", (getter)array_data_get, (setter)array_data_set, - NULL}, + NULL, NULL}, {"itemsize", (getter)array_itemsize_get, - NULL, NULL}, + NULL, NULL, NULL}, {"size", (getter)array_size_get, - NULL, NULL}, + NULL, NULL, NULL}, {"nbytes", (getter)array_nbytes_get, - NULL, NULL}, + NULL, NULL, NULL}, {"base", (getter)array_base_get, - NULL, NULL}, + NULL, NULL, NULL}, {"dtype", (getter)array_descr_get, (setter)array_descr_set, - NULL}, + NULL, NULL}, {"real", (getter)array_real_get, (setter)array_real_set, - NULL}, + NULL, NULL}, {"imag", (getter)array_imag_get, (setter)array_imag_set, - NULL}, + NULL, NULL}, {"flat", (getter)array_flat_get, (setter)array_flat_set, - NULL}, + NULL, NULL}, {"ctypes", (getter)array_ctypes_get, - NULL, NULL}, + NULL, NULL, NULL}, {"T", (getter)array_transpose_get, - NULL, NULL}, + NULL, NULL, NULL}, {"__array_interface__", (getter)array_interface_get, - NULL, NULL}, + NULL, NULL, NULL}, {"__array_struct__", (getter)array_struct_get, - NULL, NULL}, + NULL, NULL, NULL}, {"__array_priority__", (getter)array_priority_get, - NULL, NULL}, + NULL, NULL, NULL}, {"__array_finalize__", (getter)array_finalize_get, - NULL, NULL}, - {NULL, NULL, NULL, NULL}, /* Sentinel */ + NULL, NULL, NULL}, + {NULL, NULL, NULL, NULL, NULL}, /* Sentinel */ }; /****************** end of attribute get and set routines *******************/ static PyObject * -array_alloc(PyTypeObject *type, Py_ssize_t nitems) +array_alloc(PyTypeObject *type, Py_ssize_t NPY_UNUSED(nitems)) { PyObject *obj; /* nitems will always be 0 */ @@ -7017,7 +7017,17 @@ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ - 0 /* tp_weaklist */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; /* The rest of this code is to build the right kind of array from a python */ @@ -9960,7 +9970,7 @@ static PyObject * -iter_array(PyArrayIterObject *it, PyObject *op) +iter_array(PyArrayIterObject *it, PyObject *NPY_UNUSED(op)) { PyObject *r; @@ -10019,7 +10029,7 @@ /* to get array */ {"__array__", (PyCFunction)iter_array, 1, NULL}, {"copy", (PyCFunction)iter_copy, 1, NULL}, - {NULL, NULL} /* sentinel */ + {NULL, NULL, 0, NULL} /* sentinel */ }; static PyObject * @@ -10038,7 +10048,7 @@ static PyMemberDef iter_members[] = { {"base", T_OBJECT, offsetof(PyArrayIterObject, ao), RO, NULL}, {"index", T_INT, offsetof(PyArrayIterObject, index), RO, NULL}, - {NULL}, + {NULL, 0, 0, 0, NULL}, }; static PyObject * @@ -10062,9 +10072,8 @@ static PyGetSetDef iter_getsets[] = { {"coords", (getter)iter_coords_get, - NULL, - NULL}, - {NULL, NULL, NULL, NULL}, + NULL, NULL, NULL}, + {NULL, NULL, NULL, NULL, NULL}, }; static PyTypeObject PyArrayIter_Type = { @@ -10100,6 +10109,30 @@ iter_methods, /* tp_methods */ iter_members, /* tp_members */ iter_getsets, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; @@ -10783,8 +10816,18 @@ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ - 0 /* tp_weaklist */ + 0, /* tp_weaklist */ + 0, /* tp_del */ +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif + }; /** END of Subscript Iterator **/ @@ -10917,7 +10960,7 @@ } static PyObject * -arraymultiter_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) +arraymultiter_new(PyTypeObject *NPY_UNUSED(subtype), PyObject *args, PyObject *kwds) { int n, i; @@ -11046,24 +11089,24 @@ static PyGetSetDef arraymultiter_getsetlist[] = { {"size", (getter)arraymultiter_size_get, - NULL, NULL}, + NULL, NULL, NULL}, {"index", (getter)arraymultiter_index_get, - NULL, NULL}, + NULL, NULL, NULL}, {"shape", (getter)arraymultiter_shape_get, - NULL, NULL}, + NULL, NULL, NULL}, {"iters", (getter)arraymultiter_iters_get, - NULL, NULL}, - {NULL, NULL, NULL, NULL}, + NULL, NULL, NULL}, + {NULL, NULL, NULL, NULL, NULL}, }; static PyMemberDef arraymultiter_members[] = { {"numiter", T_INT, offsetof(PyArrayMultiIterObject, numiter), RO, NULL}, {"nd", T_INT, offsetof(PyArrayMultiIterObject, nd), RO, NULL}, - {NULL}, + {NULL, 0, 0, 0, NULL}, }; static PyObject * @@ -11078,7 +11121,7 @@ static PyMethodDef arraymultiter_methods[] = { {"reset", (PyCFunction) arraymultiter_reset, METH_VARARGS, NULL}, - {NULL, NULL}, + {NULL, NULL, 0, NULL}, }; static PyTypeObject PyArrayMultiIter_Type = { @@ -11128,7 +11171,17 @@ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ - 0 /* tp_weaklist */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; /*NUMPY_API*/ @@ -11226,7 +11279,7 @@ {"itemsize", T_INT, offsetof(PyArray_Descr, elsize), RO, NULL}, {"alignment", T_INT, offsetof(PyArray_Descr, alignment), RO, NULL}, {"flags", T_UBYTE, offsetof(PyArray_Descr, hasobject), RO, NULL}, - {NULL}, + {NULL, 0, 0, 0, NULL}, }; static PyObject * @@ -11490,43 +11543,43 @@ static PyGetSetDef arraydescr_getsets[] = { {"subdtype", (getter)arraydescr_subdescr_get, - NULL, NULL}, + NULL, NULL, NULL}, {"descr", (getter)arraydescr_protocol_descr_get, - NULL, NULL}, + NULL, NULL, NULL}, {"str", (getter)arraydescr_protocol_typestr_get, - NULL, NULL}, + NULL, NULL, NULL}, {"name", (getter)arraydescr_typename_get, - NULL, NULL}, + NULL, NULL, NULL}, {"base", (getter)arraydescr_base_get, - NULL, NULL}, + NULL, NULL, NULL}, {"shape", (getter)arraydescr_shape_get, - NULL, NULL}, + NULL, NULL, NULL}, {"isbuiltin", (getter)arraydescr_isbuiltin_get, - NULL, NULL}, + NULL, NULL, NULL}, {"isnative", (getter)arraydescr_isnative_get, - NULL, NULL}, + NULL, NULL, NULL}, {"fields", (getter)arraydescr_fields_get, - NULL, NULL}, + NULL, NULL, NULL}, {"names", (getter)arraydescr_names_get, (setter)arraydescr_names_set, - NULL}, + NULL, NULL}, {"hasobject", (getter)arraydescr_hasobject_get, - NULL, NULL}, - {NULL, NULL, NULL, NULL}, + NULL, NULL, NULL}, + {NULL, NULL, NULL, NULL, NULL}, }; static PyObject * -arraydescr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) +arraydescr_new(PyTypeObject *NPY_UNUSED(subtype), PyObject *args, PyObject *kwds) { PyObject *odescr; PyArray_Descr *descr, *conv; @@ -11558,7 +11611,7 @@ /* return a tuple of (callable object, args, state). */ static PyObject * -arraydescr_reduce(PyArray_Descr *self, PyObject *args) +arraydescr_reduce(PyArray_Descr *self, PyObject *NPY_UNUSED(args)) { /* version number of this pickle type. Increment if we need to change the format. Be sure to handle the old versions in @@ -11896,7 +11949,7 @@ NULL}, {"newbyteorder", (PyCFunction)arraydescr_newbyteorder, METH_VARARGS, NULL}, - {NULL, NULL} /* sentinel */ + {NULL, NULL, 0, NULL} /* sentinel */ }; static PyObject * @@ -12130,6 +12183,12 @@ descr_length, (binaryfunc)NULL, descr_repeat, + NULL, NULL, + NULL, /* sq_ass_item */ + NULL, /* ssizessizeobjargproc sq_ass_slice */ + 0, /* sq_contains */ + 0, /* sq_inplace_concat */ + 0, /* sq_inplace_repeat */ }; static PyMappingMethods descr_as_mapping = { @@ -12188,7 +12247,17 @@ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ - 0 /* tp_weaklist */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; @@ -12350,60 +12419,60 @@ {"contiguous", (getter)arrayflags_contiguous_get, NULL, - ""}, + "", NULL}, {"c_contiguous", (getter)arrayflags_contiguous_get, NULL, - ""}, + "", NULL}, {"f_contiguous", (getter)arrayflags_fortran_get, NULL, - ""}, + "", NULL}, {"fortran", (getter)arrayflags_fortran_get, NULL, - ""}, + "", NULL}, {"updateifcopy", (getter)arrayflags_updateifcopy_get, (setter)arrayflags_updateifcopy_set, - ""}, + "", NULL}, {"owndata", (getter)arrayflags_owndata_get, NULL, - ""}, + "", NULL}, {"aligned", (getter)arrayflags_aligned_get, (setter)arrayflags_aligned_set, - ""}, + "", NULL}, {"writeable", (getter)arrayflags_writeable_get, (setter)arrayflags_writeable_set, - ""}, + "", NULL}, {"fnc", (getter)arrayflags_fnc_get, NULL, - ""}, + "", NULL}, {"forc", (getter)arrayflags_forc_get, NULL, - ""}, + "", NULL}, {"behaved", (getter)arrayflags_behaved_get, NULL, - ""}, + "", NULL}, {"carray", (getter)arrayflags_carray_get, NULL, - ""}, + "", NULL}, {"farray", (getter)arrayflags_farray_get, NULL, - ""}, + "", NULL}, {"num", (getter)arrayflags_num_get, NULL, - ""}, - {NULL, NULL, NULL, NULL}, + "", NULL}, + {NULL, NULL, NULL, NULL, NULL}, }; static PyObject * @@ -12557,7 +12626,7 @@ static PyObject * -arrayflags_new(PyTypeObject *self, PyObject *args, PyObject *kwds) +arrayflags_new(PyTypeObject *NPY_UNUSED(self), PyObject *args, PyObject *NPY_UNUSED(kwds)) { PyObject *arg=NULL; if (!PyArg_UnpackTuple(args, "flagsobj", 0, 1, &arg)) @@ -12618,5 +12687,15 @@ 0, /* tp_mro */ 0, /* tp_cache */ 0, /* tp_subclasses */ - 0 /* tp_weaklist */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; Modified: branches/ufunc_cleanup/numpy/core/src/arraytypes.inc.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/arraytypes.inc.src 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/core/src/arraytypes.inc.src 2008-10-21 02:48:38 UTC (rev 5952) @@ -668,7 +668,7 @@ */ static void @from at _to_@to@(register @fromtyp@ *ip, register @totyp@ *op, register intp n, - PyArrayObject *aip, PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop)) { while (n--) { *op++ = (@totyp@)*ip; @@ -683,7 +683,7 @@ */ static void @from at _to_BOOL(register @fromtyp@ *ip, register Bool *op, register intp n, - PyArrayObject *aip, PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop)) { while (n--) { *op++ = (Bool)(*ip++ != FALSE); @@ -697,7 +697,7 @@ */ static void @from at _to_BOOL(register @fromtyp@ *ip, register Bool *op, register intp n, - PyArrayObject *aip, PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop)) { while (n--) { *op = (Bool)(((*ip).real != FALSE) || ((*ip).imag != FALSE)); @@ -712,7 +712,7 @@ */ static void BOOL_to_ at to@(register Bool *ip, register @totyp@ *op, register intp n, - PyArrayObject *aip, PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop)) { while (n--) { *op++ = (@totyp@)(*ip++ != FALSE); @@ -729,7 +729,7 @@ */ static void @from at _to_@to@(register @fromtyp@ *ip, register @totyp@ *op, register intp n, - PyArrayObject *aip, PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop)) { while (n--) { *op++ = (@totyp@)*ip++; @@ -748,7 +748,7 @@ */ static void @from at _to_@to@(register @fromtyp@ *ip, register @totyp@ *op, register intp n, - PyArrayObject *aip, PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop)) { n <<= 1; while (n--) { @@ -766,7 +766,7 @@ */ static void @from at _to_OBJECT(@fromtyp@ *ip, PyObject **op, intp n, PyArrayObject *aip, - PyArrayObject *aop) + PyArrayObject *NPY_UNUSED(aop)) { register intp i; int skip=@skip@; @@ -777,6 +777,26 @@ } /**end repeat**/ +#define _NPY_UNUSEDBOOL NPY_UNUSED +#define _NPY_UNUSEDBYTE NPY_UNUSED +#define _NPY_UNUSEDUBYTE NPY_UNUSED +#define _NPY_UNUSEDSHORT NPY_UNUSED +#define _NPY_UNUSEDUSHORT NPY_UNUSED +#define _NPY_UNUSEDINT NPY_UNUSED +#define _NPY_UNUSEDUINT NPY_UNUSED +#define _NPY_UNUSEDLONG NPY_UNUSED +#define _NPY_UNUSEDULONG NPY_UNUSED +#define _NPY_UNUSEDLONGLONG NPY_UNUSED +#define _NPY_UNUSEDULONGLONG NPY_UNUSED +#define _NPY_UNUSEDFLOAT NPY_UNUSED +#define _NPY_UNUSEDDOUBLE NPY_UNUSED +#define _NPY_UNUSEDLONGDOUBLE NPY_UNUSED +#define _NPY_UNUSEDCFLOAT NPY_UNUSED +#define _NPY_UNUSEDCDOUBLE NPY_UNUSED +#define _NPY_UNUSEDCLONGDOUBLE NPY_UNUSED +#define _NPY_UNUSEDSTRING +#define _NPY_UNUSEDVOID +#define _NPY_UNUSEDUNICODE /**begin repeat #to=BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE,CFLOAT,CDOUBLE,CLONGDOUBLE, STRING, UNICODE, VOID# @@ -784,7 +804,7 @@ #skip= 1*17, aip->descr->elsize*3# */ static void -OBJECT_to_ at to@(PyObject **ip, @totyp@ *op, intp n, PyArrayObject *aip, +OBJECT_to_ at to@(PyObject **ip, @totyp@ *op, intp n, PyArrayObject *_NPY_UNUSED at to@(aip), PyArrayObject *aop) { register intp i; @@ -883,7 +903,7 @@ #format="hd","hu","d","u","ld","lu",LONGLONG_FMT,ULONGLONG_FMT,"f","lf","Lf"# */ static int - at fname@_scan (FILE *fp, @type@ *ip, void *ignore, PyArray_Descr *ignore2) + at fname@_scan (FILE *fp, @type@ *ip, void *NPY_UNUSED(ignore), PyArray_Descr *NPY_UNUSED(ignored)) { return fscanf(fp, "%"@format@, ip); } @@ -897,7 +917,7 @@ #format="d","u"# */ static int - at fname@_scan (FILE *fp, @type@ *ip, void *ignore, PyArray_Descr *ignore2) + at fname@_scan (FILE *fp, @type@ *ip, void *NPY_UNUSED(ignore), PyArray_Descr *NPY_UNUSED(ignore2)) { @btype@ temp; int num; @@ -908,7 +928,7 @@ /**end repeat**/ static int -BOOL_scan (FILE *fp, Bool *ip, void *ignore, PyArray_Descr *ignore2) +BOOL_scan (FILE *fp, Bool *ip, void *NPY_UNUSED(ignore), PyArray_Descr *NPY_UNUSED(ignore2)) { int temp; int num; @@ -932,7 +952,7 @@ #btype=(long,ulong)*5# */ static int - at fname@_fromstr(char *str, @type@ *ip, char **endptr, PyArray_Descr *ignore) + at fname@_fromstr(char *str, @type@ *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore)) { @btype@ result; @@ -948,7 +968,7 @@ */ #if (PY_VERSION_HEX >= 0x02040000) || defined(PyOS_ascii_strtod) static int - at fname@_fromstr(char *str, @type@ *ip, char **endptr, PyArray_Descr *ignore) + at fname@_fromstr(char *str, @type@ *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore)) { double result; @@ -980,7 +1000,7 @@ */ static void @fname at _copyswapn (void *dst, intp dstride, void *src, intp sstride, - intp n, int swap, void *arr) + intp n, int swap, void *NPY_UNUSED(arr)) { if (src != NULL) { if (sstride == sizeof(@type@) && dstride == sizeof(@type@)) { @@ -997,7 +1017,7 @@ } static void - at fname@_copyswap (void *dst, void *src, int swap, void *arr) + at fname@_copyswap (void *dst, void *src, int swap, void *NPY_UNUSED(arr)) { if (src != NULL) /* copy first if needed */ @@ -1067,7 +1087,7 @@ */ static void @fname at _copyswapn (void *dst, intp dstride, void *src, intp sstride, intp n, - int swap, void *arr) + int NPY_UNUSED(swap), void *NPY_UNUSED(arr)) { if (src != NULL) { if (sstride == sizeof(@type@) && dstride == sizeof(@type@)) { @@ -1082,7 +1102,7 @@ } static void - at fname@_copyswap (void *dst, void *src, int swap, void *arr) + at fname@_copyswap (void *dst, void *src, int NPY_UNUSED(swap), void *NPY_UNUSED(arr)) { if (src != NULL) /* copy first if needed */ memcpy(dst, src, sizeof(@type@)); @@ -1101,7 +1121,7 @@ */ static void @fname at _copyswapn (void *dst, intp dstride, void *src, intp sstride, intp n, - int swap, void *arr) + int swap, void *NPY_UNUSED(arr)) { if (src != NULL) { /* copy first if needed */ @@ -1123,7 +1143,7 @@ } static void - at fname@_copyswap (void *dst, void *src, int swap, void *arr) + at fname@_copyswap (void *dst, void *src, int swap, void *NPY_UNUSED(arr)) { if (src != NULL) /* copy first if needed */ memcpy(dst, src, sizeof(@type@)); @@ -1225,7 +1245,7 @@ #define __ALIGNED(obj, sz) ((((size_t) obj) % (sz))==0) static void OBJECT_copyswapn (PyObject **dst, intp dstride, PyObject **src, intp sstride, - register intp n, int swap, void *arr) + register intp n, int NPY_UNUSED(swap), void *NPY_UNUSED(arr)) { register intp i; if (src != NULL) { @@ -1258,7 +1278,7 @@ } static void -OBJECT_copyswap(PyObject **dst, PyObject **src, int swap, void *arr) +OBJECT_copyswap(PyObject **dst, PyObject **src, int NPY_UNUSED(swap), void *NPY_UNUSED(arr)) { if (src != NULL) { @@ -1279,7 +1299,7 @@ /* ignore swap */ static void STRING_copyswapn (char *dst, intp dstride, char *src, intp sstride, - intp n, int swap, PyArrayObject *arr) + intp n, int NPY_UNUSED(swap), PyArrayObject *arr) { if (src != NULL && arr != NULL) { int itemsize = arr->descr->elsize; @@ -1422,7 +1442,7 @@ static void -STRING_copyswap (char *dst, char *src, int swap, PyArrayObject *arr) +STRING_copyswap(char *dst, char *src, int NPY_UNUSED(swap), PyArrayObject *arr) { if (src != NULL && arr != NULL) { memcpy(dst, src, arr->descr->elsize); @@ -1633,7 +1653,7 @@ /****************** compare **********************************/ static int -BOOL_compare(Bool *ip1, Bool *ip2, PyArrayObject *ap) +BOOL_compare(Bool *ip1, Bool *ip2, PyArrayObject *NPY_UNUSED(ap)) { return (*ip1 ? (*ip2 ? 0 : 1) : (*ip2 ? -1 : 0)); } @@ -1644,7 +1664,7 @@ */ static int - at fname@_compare (@type@ *ip1, @type@ *ip2, PyArrayObject *ap) + at fname@_compare (@type@ *ip1, @type@ *ip2, PyArrayObject *NPY_UNUSED(ap)) { return *ip1 < *ip2 ? -1 : *ip1 == *ip2 ? 0 : 1; } @@ -1658,7 +1678,7 @@ */ static int - at fname@_compare (@type@ *ip1, @type@ *ip2, PyArrayObject *ap) + at fname@_compare (@type@ *ip1, @type@ *ip2, PyArrayObject *NPY_UNUSED(ap)) { if (*ip1 == *ip2) { return ip1[1]f->scanfunc(*fp, dptr, NULL, dtype); @@ -6095,7 +6095,7 @@ } static int -fromfile_skip_separator(FILE **fp, const char *sep, void *stream_data) +fromfile_skip_separator(FILE **fp, const char *sep, void *NPY_UNUSED(stream_data)) { int result = 0; const char *sep_start = sep; @@ -6307,7 +6307,7 @@ } static PyObject * -array_fromstring(PyObject *ignored, PyObject *args, PyObject *keywds) +array_fromstring(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *keywds) { char *data; Py_ssize_t nin=-1; @@ -6440,7 +6440,7 @@ } static PyObject * -array_fromfile(PyObject *ignored, PyObject *args, PyObject *keywds) +array_fromfile(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *keywds) { PyObject *file=NULL, *ret; FILE *fp; @@ -6579,7 +6579,7 @@ } static PyObject * -array_fromiter(PyObject *ignored, PyObject *args, PyObject *keywds) +array_fromiter(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *keywds) { PyObject *iter; Py_ssize_t nin=-1; @@ -6698,7 +6698,7 @@ } static PyObject * -array_frombuffer(PyObject *ignored, PyObject *args, PyObject *keywds) +array_frombuffer(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *keywds) { PyObject *obj=NULL; Py_ssize_t nin=-1, offset=0; @@ -6721,7 +6721,7 @@ } static PyObject * -array_concatenate(PyObject *dummy, PyObject *args, PyObject *kwds) +array_concatenate(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *a0; int axis=0; @@ -6734,7 +6734,7 @@ return PyArray_Concatenate(a0, axis); } -static PyObject *array_innerproduct(PyObject *dummy, PyObject *args) { +static PyObject *array_innerproduct(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *b0, *a0; if (!PyArg_ParseTuple(args, "OO", &a0, &b0)) return NULL; @@ -6742,7 +6742,7 @@ return _ARET(PyArray_InnerProduct(a0, b0)); } -static PyObject *array_matrixproduct(PyObject *dummy, PyObject *args) { +static PyObject *array_matrixproduct(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *v, *a; if (!PyArg_ParseTuple(args, "OO", &a, &v)) return NULL; @@ -6750,7 +6750,7 @@ return _ARET(PyArray_MatrixProduct(a, v)); } -static PyObject *array_fastCopyAndTranspose(PyObject *dummy, PyObject *args) { +static PyObject *array_fastCopyAndTranspose(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *a0; if (!PyArg_ParseTuple(args, "O", &a0)) return NULL; @@ -6758,7 +6758,7 @@ return _ARET(PyArray_CopyAndTranspose(a0)); } -static PyObject *array_correlate(PyObject *dummy, PyObject *args, PyObject *kwds) { +static PyObject *array_correlate(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *shape, *a0; int mode=0; static char *kwlist[] = {"a", "v", "mode", NULL}; @@ -6988,7 +6988,7 @@ } static PyObject * -array_arange(PyObject *ignored, PyObject *args, PyObject *kws) { +array_arange(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *kws) { PyObject *o_start=NULL, *o_stop=NULL, *o_step=NULL; static char *kwd[]= {"start", "stop", "step", "dtype", NULL}; PyArray_Descr *typecode=NULL; @@ -7015,7 +7015,7 @@ } static PyObject * -array__get_ndarray_c_version(PyObject *dummy, PyObject *args, PyObject *kwds) +array__get_ndarray_c_version(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { static char *kwlist[] = {NULL}; if(!PyArg_ParseTupleAndKeywords(args, kwds, "", kwlist )) return NULL; @@ -7024,7 +7024,7 @@ } static PyObject * -array__reconstruct(PyObject *dummy, PyObject *args) +array__reconstruct(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *ret; @@ -7056,7 +7056,7 @@ } static PyObject * -array_set_string_function(PyObject *dummy, PyObject *args, PyObject *kwds) +array_set_string_function(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *op=NULL; int repr=1; @@ -7078,7 +7078,7 @@ } static PyObject * -array_set_ops_function(PyObject *self, PyObject *args, PyObject *kwds) +array_set_ops_function(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args), PyObject *kwds) { PyObject *oldops=NULL; @@ -7145,7 +7145,7 @@ } static PyObject * -array_where(PyObject *ignored, PyObject *args) +array_where(PyObject *NPY_UNUSED(ignored), PyObject *args) { PyObject *obj=NULL, *x=NULL, *y=NULL; @@ -7155,7 +7155,7 @@ } static PyObject * -array_lexsort(PyObject *ignored, PyObject *args, PyObject *kwds) +array_lexsort(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *kwds) { int axis=-1; PyObject *obj; @@ -7170,7 +7170,7 @@ #undef _ARET static PyObject * -array_can_cast_safely(PyObject *dummy, PyObject *args, PyObject *kwds) +array_can_cast_safely(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyArray_Descr *d1=NULL; PyArray_Descr *d2=NULL; @@ -7201,7 +7201,7 @@ } static PyObject * -new_buffer(PyObject *dummy, PyObject *args) +new_buffer(PyObject *NPY_UNUSED(dummy), PyObject *args) { int size; @@ -7212,7 +7212,7 @@ } static PyObject * -buffer_buffer(PyObject *dummy, PyObject *args, PyObject *kwds) +buffer_buffer(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *obj; Py_ssize_t offset=0, size=Py_END_OF_BUFFER, n; @@ -7258,7 +7258,7 @@ } static PyObject * -as_buffer(PyObject *dummy, PyObject *args, PyObject *kwds) +as_buffer(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *mem; Py_ssize_t size; @@ -7315,7 +7315,7 @@ #undef _test_code static PyObject * -format_longfloat(PyObject *dummy, PyObject *args, PyObject *kwds) +format_longfloat(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *obj; unsigned int precision; @@ -7340,7 +7340,7 @@ } static PyObject * -compare_chararrays(PyObject *dummy, PyObject *args, PyObject *kwds) +compare_chararrays(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) { PyObject *array; PyObject *other; @@ -7441,7 +7441,7 @@ static PyObject * -test_interrupt(PyObject *self, PyObject *args) +test_interrupt(PyObject *NPY_UNUSED(self), PyObject *args) { int kind=0; int a = 0; @@ -7531,7 +7531,7 @@ METH_VARARGS | METH_KEYWORDS, NULL}, {"test_interrupt", (PyCFunction)test_interrupt, METH_VARARGS, NULL}, - {NULL, NULL, 0} /* sentinel */ + {NULL, NULL, 0, NULL} /* sentinel */ }; #include "__multiarray_api.c" @@ -7546,7 +7546,7 @@ Thus, we call PyType_Ready on the standard Python Types, here. */ static int -setup_scalartypes(PyObject *dict) +setup_scalartypes(PyObject *NPY_UNUSED(dict)) { initialize_numeric_types(); Modified: branches/ufunc_cleanup/numpy/core/src/scalarmathmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/scalarmathmodule.c.src 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/core/src/scalarmathmodule.c.src 2008-10-21 02:48:38 UTC (rev 5952) @@ -14,6 +14,7 @@ /** numarray adapted routines.... **/ +#if SIZEOF_LONGLONG == 64 || SIZEOF_LONGLONG == 128 static int ulonglong_overflow(ulonglong a, ulonglong b) { ulonglong ah, al, bh, bl, w, x, y, z; @@ -50,6 +51,12 @@ #endif } +#else +static int ulonglong_overflow(ulonglong NPY_UNUSED(a), ulonglong NPY_UNUSED(b)) +{ + return 0; +} +#endif static int slonglong_overflow(longlong a0, longlong b0) { @@ -665,7 +672,7 @@ **/ static PyObject * - at name@_power(PyObject *a, PyObject *b, PyObject *c) + at name@_power(PyObject *a, PyObject *b, PyObject *NPY_UNUSED(c)) { PyObject *ret; @name@ arg1, arg2; @@ -1117,7 +1124,7 @@ char doc_alterpyscalars[] = ""; static PyObject * -alter_pyscalars(PyObject *dummy, PyObject *args) +alter_pyscalars(PyObject *NPY_UNUSED(dummy), PyObject *args) { int n; PyObject *obj; @@ -1152,7 +1159,7 @@ char doc_restorepyscalars[] = ""; static PyObject * -restore_pyscalars(PyObject *dummy, PyObject *args) +restore_pyscalars(PyObject *NPY_UNUSED(dummy), PyObject *args) { int n; PyObject *obj; @@ -1186,7 +1193,7 @@ char doc_usepythonmath[] = ""; static PyObject * -use_pythonmath(PyObject *dummy, PyObject *args) +use_pythonmath(PyObject *NPY_UNUSED(dummy), PyObject *args) { int n; PyObject *obj; @@ -1220,7 +1227,7 @@ char doc_usescalarmath[] = ""; static PyObject * -use_scalarmath(PyObject *dummy, PyObject *args) +use_scalarmath(PyObject *NPY_UNUSED(dummy), PyObject *args) { int n; PyObject *obj; @@ -1261,7 +1268,7 @@ METH_VARARGS, doc_usepythonmath}, {"use_scalarmath", (PyCFunction) use_scalarmath, METH_VARARGS, doc_usescalarmath}, - {NULL, NULL, 0} + {NULL, NULL, 0, NULL} }; PyMODINIT_FUNC initscalarmath(void) { Modified: branches/ufunc_cleanup/numpy/core/src/scalartypes.inc.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/scalartypes.inc.src 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/core/src/scalartypes.inc.src 2008-10-21 02:48:38 UTC (rev 5952) @@ -24,6 +24,59 @@ 0, /*ob_size*/ "numpy. at name@", /*tp_name*/ sizeof(PyObject), /*tp_basicsize*/ + 0, /* tp_itemsize */ + /* methods */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* 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 */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; /**end repeat**/ @@ -373,7 +426,7 @@ static PyObject * -gentype_power(PyObject *m1, PyObject *m2, PyObject *m3) +gentype_power(PyObject *m1, PyObject *m2, PyObject *NPY_UNUSED(m3)) { PyObject *arr, *ret, *arg2; char *msg="unsupported operand type(s) for ** or pow()"; @@ -770,13 +823,13 @@ } static PyObject * -gentype_ndim_get(PyObject *self) +gentype_ndim_get(PyObject *NPY_UNUSED(self)) { return PyInt_FromLong(0); } static PyObject * -gentype_flags_get(PyObject *self) +gentype_flags_get(PyObject *NPY_UNUSED(self)) { return PyArray_NewFlagsObject(NULL); } @@ -827,7 +880,7 @@ } static PyObject * -gentype_size_get(PyObject *self) +gentype_size_get(PyObject *NPY_UNUSED(self)) { return PyInt_FromLong(1); } @@ -866,13 +919,13 @@ } static PyObject * -gentype_priority_get(PyObject *self) +gentype_priority_get(PyObject *NPY_UNUSED(self)) { return PyFloat_FromDouble(NPY_SCALAR_PRIORITY); } static PyObject * -gentype_shape_get(PyObject *self) +gentype_shape_get(PyObject *NPY_UNUSED(self)) { return PyTuple_New(0); } @@ -902,7 +955,7 @@ static PyObject * -gentype_base_get(PyObject *self) +gentype_base_get(PyObject *NPY_UNUSED(self)) { Py_INCREF(Py_None); return Py_None; @@ -1019,72 +1072,89 @@ {"ndim", (getter)gentype_ndim_get, (setter) 0, - "number of array dimensions"}, + "number of array dimensions", + NULL}, {"flags", (getter)gentype_flags_get, (setter)0, - "integer value of flags"}, + "integer value of flags", + NULL}, {"shape", (getter)gentype_shape_get, (setter)0, - "tuple of array dimensions"}, + "tuple of array dimensions", + NULL}, {"strides", (getter)gentype_shape_get, (setter) 0, - "tuple of bytes steps in each dimension"}, + "tuple of bytes steps in each dimension", + NULL}, {"data", (getter)gentype_data_get, (setter) 0, - "pointer to start of data"}, + "pointer to start of data", + NULL}, {"itemsize", (getter)gentype_itemsize_get, (setter)0, - "length of one element in bytes"}, + "length of one element in bytes", + NULL}, {"size", (getter)gentype_size_get, (setter)0, - "number of elements in the gentype"}, + "number of elements in the gentype", + NULL}, {"nbytes", (getter)gentype_itemsize_get, (setter)0, - "length of item in bytes"}, + "length of item in bytes", + NULL}, {"base", (getter)gentype_base_get, (setter)0, - "base object"}, + "base object", + NULL}, {"dtype", (getter)gentype_typedescr_get, NULL, - "get array data-descriptor"}, + "get array data-descriptor", + NULL}, {"real", (getter)gentype_real_get, (setter)0, - "real part of scalar"}, + "real part of scalar", + NULL}, {"imag", (getter)gentype_imag_get, (setter)0, - "imaginary part of scalar"}, + "imaginary part of scalar", + NULL}, {"flat", (getter)gentype_flat_get, (setter)0, - "a 1-d view of scalar"}, + "a 1-d view of scalar", + NULL}, {"T", (getter)gentype_transpose_get, (setter)0, - "transpose"}, + "transpose", + NULL}, {"__array_interface__", (getter)gentype_interface_get, NULL, - "Array protocol: Python side"}, + "Array protocol: Python side", + NULL}, {"__array_struct__", (getter)gentype_struct_get, NULL, - "Array protocol: struct"}, + "Array protocol: struct", + NULL}, {"__array_priority__", (getter)gentype_priority_get, NULL, - "Array priority."}, - {NULL, NULL, NULL, NULL} /* Sentinel */ + "Array priority.", + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; @@ -1110,7 +1180,7 @@ static char doc_sc_wraparray[] = "sc.__array_wrap__(obj) return scalar from array"; static PyObject * -gentype_wraparray(PyObject *scalar, PyObject *args) +gentype_wraparray(PyObject *NPY_UNUSED(scalar), PyObject *args) { PyObject *arr; @@ -1143,7 +1213,7 @@ /**end repeat**/ static PyObject * -gentype_itemset(PyObject *self, PyObject *args) +gentype_itemset(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args)) { PyErr_SetString(PyExc_ValueError, "array-scalars are immutable"); return NULL; @@ -1230,7 +1300,7 @@ } static PyObject * -gentype_setfield(PyObject *self, PyObject *args, PyObject *kwds) +gentype_setfield(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args), PyObject *NPY_UNUSED(kwds)) { PyErr_SetString(PyExc_TypeError, "Can't set fields in a non-void array scalar."); @@ -1296,7 +1366,7 @@ static PyObject * -gentype_reduce(PyObject *self, PyObject *args) +gentype_reduce(PyObject *self, PyObject *NPY_UNUSED(args)) { PyObject *ret=NULL, *obj=NULL, *mod=NULL; const char *buffer; @@ -1369,7 +1439,7 @@ /* ignores everything */ static PyObject * -gentype_setstate(PyObject *self, PyObject *args) +gentype_setstate(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args)) { Py_INCREF(Py_None); return (Py_None); @@ -1400,7 +1470,7 @@ /* setting flags cannot be done for scalars */ static PyObject * -gentype_setflags(PyObject *self, PyObject *args, PyObject *kwds) +gentype_setflags(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args), PyObject *NPY_UNUSED(kwds)) { Py_INCREF(Py_None); return Py_None; @@ -1574,7 +1644,7 @@ {"newbyteorder", (PyCFunction)gentype_newbyteorder, METH_VARARGS, NULL}, - {NULL, NULL} /* sentinel */ + {NULL, NULL, 0, NULL} /* sentinel */ }; @@ -1582,12 +1652,14 @@ {"flags", (getter)voidtype_flags_get, (setter)0, - "integer value of flags"}, + "integer value of flags", + NULL}, {"dtype", (getter)voidtype_dtypedescr_get, (setter)0, - "dtype object"}, - {NULL, NULL} + "dtype object", + NULL}, + {NULL, NULL, NULL, NULL, NULL} }; static PyMethodDef voidtype_methods[] = { @@ -1597,7 +1669,7 @@ {"setfield", (PyCFunction)voidtype_setfield, METH_VARARGS | METH_KEYWORDS, NULL}, - {NULL, NULL} + {NULL, NULL, 0, NULL} }; /************* As_mapping functions for void array scalar ************/ @@ -1757,15 +1829,19 @@ 0, /*sq_repeat*/ (ssizeargfunc)voidtype_item, /*sq_item*/ 0, /*sq_slice*/ - (ssizeobjargproc)voidtype_ass_item /*sq_ass_item*/ + (ssizeobjargproc)voidtype_ass_item, /*sq_ass_item*/ #else (inquiry)voidtype_length, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ (intargfunc)voidtype_item, /*sq_item*/ 0, /*sq_slice*/ - (intobjargproc)voidtype_ass_item /*sq_ass_item*/ + (intobjargproc)voidtype_ass_item, /*sq_ass_item*/ #endif + 0, /* ssq_ass_slice */ + 0, /* sq_contains */ + 0, /* sq_inplace_concat */ + 0, /* sq_inplace_repeat */ }; @@ -1844,6 +1920,59 @@ 0, /*ob_size*/ "numpy.generic", /*tp_name*/ sizeof(PyObject), /*tp_basicsize*/ + 0, /* tp_itemsize */ + /* methods */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* 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 */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; static void @@ -1892,8 +2021,16 @@ #work=0,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,z,z,0# #default=0*16,1*2,2# */ + +#define _NPY_UNUSED2_1 +#define _NPY_UNUSED2_z +#define _NPY_UNUSED2_0 NPY_UNUSED +#define _NPY_UNUSED1_0 +#define _NPY_UNUSED1_1 +#define _NPY_UNUSED1_2 NPY_UNUSED + static PyObject * - at name@_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) + at name@_arrtype_new(PyTypeObject *_NPY_UNUSED1_ at default@(type), PyObject *args, PyObject *_NPY_UNUSED2_ at work@(kwds)) { PyObject *obj = NULL; PyObject *robj; @@ -1999,7 +2136,7 @@ /* bool->tp_new only returns Py_True or Py_False */ static PyObject * -bool_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +bool_arrtype_new(PyTypeObject *NPY_UNUSED(type), PyObject *args, PyObject *NPY_UNUSED(kwds)) { PyObject *obj=NULL; PyObject *arr; @@ -2092,10 +2229,36 @@ (binaryfunc)bool_arrtype_and, /* nb_and */ (binaryfunc)bool_arrtype_xor, /* nb_xor */ (binaryfunc)bool_arrtype_or, /* nb_or */ + 0, /* nb_coerce */ + 0, /* nb_int */ + 0, /* nb_long */ + 0, /* nb_float */ + 0, /* nb_oct */ + 0, /* nb_hex */ + /* Added in release 2.0 */ + 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 */ + /* Added in release 2.2 */ + /* The following require the Py_TPFLAGS_HAVE_CLASS flag */ + 0, /* nb_floor_divide */ + 0, /* nb_true_divide */ + 0, /* nb_inplace_floor_divide */ + 0, /* nb_inplace_true_divide */ + /* Added in release 2.5 */ + 0, /* nb_index */ }; static PyObject * -void_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +void_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *NPY_UNUSED(kwds)) { PyObject *obj, *arr; ulonglong memu=1; @@ -2489,6 +2652,40 @@ (setattrofunc)object_arrtype_setattro, /* tp_setattro */ &object_arrtype_as_buffer, /* tp_as_buffer */ 0, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* 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 */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; @@ -2549,6 +2746,57 @@ 0, /*ob_size*/ "numpy. at name@@ex@", /*tp_name*/ sizeof(Py at NAME@ScalarObject), /*tp_basicsize*/ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* 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 */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; /**end repeat**/ @@ -2579,6 +2827,57 @@ 0, /*ob_size*/ "numpy. at name@" _THIS_SIZE, /*tp_name*/ sizeof(Py at NAME@ScalarObject), /*tp_basicsize*/ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* 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 */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; #undef _THIS_SIZE @@ -2642,6 +2941,39 @@ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ "Composed of two " _THIS_SIZE2 " bit floats", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* 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 */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; #undef _THIS_SIZE1 #undef _THIS_SIZE2 Modified: branches/ufunc_cleanup/numpy/core/src/ufuncobject.c =================================================================== --- branches/ufunc_cleanup/numpy/core/src/ufuncobject.c 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/core/src/ufuncobject.c 2008-10-21 02:48:38 UTC (rev 5952) @@ -3500,7 +3500,7 @@ } static PyObject * -ufunc_geterr(PyObject *dummy, PyObject *args) +ufunc_geterr(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *thedict; PyObject *res; @@ -3563,7 +3563,7 @@ #endif static PyObject * -ufunc_seterr(PyObject *dummy, PyObject *args) +ufunc_seterr(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *thedict; int res; @@ -3600,7 +3600,7 @@ doc_frompyfunc[] = "frompyfunc(func, nin, nout) take an arbitrary python function that takes nin objects as input and returns nout objects and return a universal function (ufunc). This ufunc always returns PyObject arrays"; static PyObject * -ufunc_frompyfunc(PyObject *dummy, PyObject *args, PyObject *kwds) { +ufunc_frompyfunc(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *NPY_UNUSED(kwds)) { /* Keywords are ignored for now */ PyObject *function, *pyname=NULL; @@ -4034,13 +4034,13 @@ static struct PyMethodDef ufunc_methods[] = { - {"reduce", (PyCFunction)ufunc_reduce, METH_VARARGS | METH_KEYWORDS }, + {"reduce", (PyCFunction)ufunc_reduce, METH_VARARGS | METH_KEYWORDS, NULL }, {"accumulate", (PyCFunction)ufunc_accumulate, - METH_VARARGS | METH_KEYWORDS }, + METH_VARARGS | METH_KEYWORDS, NULL }, {"reduceat", (PyCFunction)ufunc_reduceat, - METH_VARARGS | METH_KEYWORDS }, - {"outer", (PyCFunction)ufunc_outer, METH_VARARGS | METH_KEYWORDS }, - {NULL, NULL} /* sentinel */ + METH_VARARGS | METH_KEYWORDS, NULL }, + {"outer", (PyCFunction)ufunc_outer, METH_VARARGS | METH_KEYWORDS, NULL}, + {NULL, NULL, 0, NULL} /* sentinel */ }; @@ -4193,15 +4193,15 @@ /* static char *Ufunctype__doc__ = NULL; */ static PyGetSetDef ufunc_getset[] = { - {"__doc__", (getter)ufunc_get_doc, NULL, "documentation string"}, - {"nin", (getter)ufunc_get_nin, NULL, "number of inputs"}, - {"nout", (getter)ufunc_get_nout, NULL, "number of outputs"}, - {"nargs", (getter)ufunc_get_nargs, NULL, "number of arguments"}, - {"ntypes", (getter)ufunc_get_ntypes, NULL, "number of types"}, - {"types", (getter)ufunc_get_types, NULL, "return a list with types grouped input->output"}, - {"__name__", (getter)ufunc_get_name, NULL, "function name"}, - {"identity", (getter)ufunc_get_identity, NULL, "identity value"}, - {NULL, NULL, NULL, NULL}, /* Sentinel */ + {"__doc__", (getter)ufunc_get_doc, NULL, "documentation string", NULL}, + {"nin", (getter)ufunc_get_nin, NULL, "number of inputs", NULL}, + {"nout", (getter)ufunc_get_nout, NULL, "number of outputs", NULL}, + {"nargs", (getter)ufunc_get_nargs, NULL, "number of arguments", NULL}, + {"ntypes", (getter)ufunc_get_ntypes, NULL, "number of types", NULL}, + {"types", (getter)ufunc_get_types, NULL, "return a list with types grouped input->output", NULL}, + {"__name__", (getter)ufunc_get_name, NULL, "function name", NULL}, + {"identity", (getter)ufunc_get_identity, NULL, "identity value", NULL}, + {NULL, NULL, NULL, NULL, NULL}, /* Sentinel */ }; static PyTypeObject PyUFunc_Type = { @@ -4237,6 +4237,31 @@ ufunc_methods, /* tp_methods */ 0, /* tp_members */ ufunc_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ + 0, /* tp_prev */ + 0, /* *tp_next */ +#endif }; /* End of code for ufunc objects */ Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-21 02:48:38 UTC (rev 5952) @@ -56,7 +56,7 @@ } static PyObject * -Py_get_one(PyObject *o) +Py_get_one(PyObject *NPY_UNUSED(o)) { return PyInt_FromLong(1); } @@ -106,7 +106,7 @@ */ -/* +/* * Don't pass structures between functions (only pointers) because how * structures are passed is compiler dependent and could cause * segfaults if ufuncobject.c is compiled with a different compiler @@ -554,7 +554,7 @@ **/ static void -BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { Bool in1 = *((Bool *)ip1) != 0; @@ -565,7 +565,7 @@ /**end repeat**/ static void -BOOL_logical_xor(char **args, intp *dimensions, intp *steps, void *func) +BOOL_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { Bool in1 = *((Bool *)ip1) != 0; @@ -579,7 +579,7 @@ * #OP = >, <# **/ static void -BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { Bool in1 = *((Bool *)ip1) != 0; @@ -594,7 +594,7 @@ * #OP = !=, ==# **/ static void -BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +BOOL_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { Bool in1 = *(Bool *)ip1; @@ -604,7 +604,7 @@ /**end repeat**/ static void -BOOL_ones_like(char **args, intp *dimensions, intp *steps, void *data) +BOOL_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { OUTPUT_LOOP { *((Bool *)op) = 1; @@ -633,7 +633,7 @@ #define @S@@TYPE at _floor_divide @S@@TYPE at _divide static void - at S@@TYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { OUTPUT_LOOP { *((@s@@type@ *)op) = 1; @@ -641,7 +641,7 @@ } static void - at S@@TYPE at _square(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _square(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -650,16 +650,16 @@ } static void - at S@@TYPE at _reciprocal(char **args, intp *dimensions, intp *steps, void *data) + at S@@TYPE at _reciprocal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; - *((@s@@type@ *)op) = (@s@@type@)(1.0/in1); + *((@s@@type@ *)op) = 1.0/in1; } } static void - at S@@TYPE at _conjugate(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _conjugate(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -668,7 +668,7 @@ } static void - at S@@TYPE at _negative(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -677,7 +677,7 @@ } static void - at S@@TYPE at _logical_not(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -686,7 +686,7 @@ } static void - at S@@TYPE at _invert(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -701,7 +701,7 @@ * #OP = +, -,*, &, |, ^, <<, >># */ static void - at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -717,7 +717,7 @@ * #OP = ==, !=, >, >=, <, <=, &&, ||# */ static void - at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -728,7 +728,7 @@ /**end repeat2**/ static void - at S@@TYPE at _logical_xor(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -742,7 +742,7 @@ * #OP = >, <# **/ static void - at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -753,7 +753,7 @@ /**end repeat2**/ static void - at S@@TYPE at _true_divide(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _true_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -769,7 +769,7 @@ } static void - at S@@TYPE at _power(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _power(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @ftype@ in1 = (@ftype@)*(@s@@type@ *)ip1; @@ -779,7 +779,7 @@ } static void - at S@@TYPE at _fmod(char **args, intp *dimensions, intp *steps, void *func) + at S@@TYPE at _fmod(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; @@ -798,7 +798,7 @@ /**end repeat1**/ static void -U at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) +U at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const u at type@ in1 = *(u at type@ *)ip1; @@ -807,7 +807,7 @@ } static void - at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -816,7 +816,7 @@ } static void -U at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) +U at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const u at type@ in1 = *(u at type@ *)ip1; @@ -825,7 +825,7 @@ } static void - at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -834,7 +834,7 @@ } static void - at TYPE@_divide(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -853,7 +853,7 @@ } static void -U at TYPE@_divide(char **args, intp *dimensions, intp *steps, void *func) +U at TYPE@_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const u at type@ in1 = *(u at type@ *)ip1; @@ -869,7 +869,7 @@ } static void - at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -892,7 +892,7 @@ } static void -U at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) +U at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const u at type@ in1 = *(u at type@ *)ip1; @@ -924,16 +924,13 @@ * #C = F, , L# */ -#define ONE 1.0 at c@ -#define ZERO 0.0 at c@ - /**begin repeat1 * Arithmetic * # kind = add, subtract, multiply, divide# * # OP = +, -, *, /# */ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -949,7 +946,7 @@ * #OP = ==, !=, <, <=, >, >=, &&, ||# */ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -960,7 +957,7 @@ /**end repeat1**/ static void - at TYPE@_logical_xor(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -970,7 +967,7 @@ } static void - at TYPE@_logical_not(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -983,7 +980,7 @@ * #func = isnan, isinf, isfinite, signbit# **/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -994,48 +991,32 @@ /**begin repeat1 * #kind = maximum, minimum# - * #OP = >=, <=# + * #OP = >, <# **/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { /* */ BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; const @type@ in2 = *(@type@ *)ip2; - *((@type@ *)op) = (in1 @OP@ in2 || isnan(in1)) ? in1 : in2; + *((@type@ *)op) = in1 @OP@ in2 ? in1 : in2; } } /**end repeat1**/ -/**begin repeat1 - * #kind = fmax, fmin# - * #OP = >=, <=# - **/ static void - at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_floor_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { - /* */ BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; const @type@ in2 = *(@type@ *)ip2; - *((@type@ *)op) = (in1 @OP@ in2 || isnan(in2)) ? in1 : in2; - } -} -/**end repeat1**/ - -static void - at TYPE@_floor_divide(char **args, intp *dimensions, intp *steps, void *func) -{ - BINARY_LOOP { - const @type@ in1 = *(@type@ *)ip1; - const @type@ in2 = *(@type@ *)ip2; *((@type@ *)op) = floor at c@(in1/in2); } } static void - at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1051,7 +1032,7 @@ } static void - at TYPE@_square(char **args, intp *dimensions, intp *steps, void *data) + at TYPE@_square(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1060,24 +1041,24 @@ } static void - at TYPE@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) + at TYPE@_reciprocal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; - *((@type@ *)op) = ONE/in1; + *((@type@ *)op) = 1.0/in1; } } static void - at TYPE@_ones_like(char **args, intp *dimensions, intp *steps, void *data) + at TYPE@_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { OUTPUT_LOOP { - *((@type@ *)op) = ONE; + *((@type@ *)op) = 1; } } static void - at TYPE@_conjugate(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_conjugate(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1086,18 +1067,18 @@ } static void - at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; - const @type@ tmp = in1 > 0 ? in1 : -in1; + const @type@ tmp = (in1 > 0) ? in1 : -in1; /* add 0 to clear -0.0 */ *((@type@ *)op) = tmp + 0; } } static void - at TYPE@_negative(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1106,7 +1087,7 @@ } static void - at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { /* */ UNARY_LOOP { @@ -1124,7 +1105,7 @@ } static void - at TYPE@_modf(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_modf(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP_TWO_OUT { const @type@ in1 = *(@type@ *)ip1; @@ -1134,7 +1115,7 @@ #ifdef HAVE_FREXP at C@ static void - at TYPE@_frexp(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_frexp(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP_TWO_OUT { const @type@ in1 = *(@type@ *)ip1; @@ -1145,7 +1126,7 @@ #ifdef HAVE_LDEXP at C@ static void - at TYPE@_ldexp(char **args, intp *dimensions, intp *steps, void *func) + at TYPE@_ldexp(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; @@ -1157,9 +1138,6 @@ #define @TYPE at _true_divide @TYPE at _divide -#undef ONE -#undef ZERO - /**end repeat**/ @@ -1177,18 +1155,13 @@ * #c = f, , l# */ -#define CGE(xr,xi,yr,yi) (xr > yr || (xr == yr && xi >= yi)) -#define CLE(xr,xi,yr,yi) (xr < yr || (xr == yr && xi <= yi)) -#define ONE 1.0 at c@ -#define ZERO 0.0 at c@ - /**begin repeat1 * arithmetic * #kind = add, subtract# * #OP = +, -# */ static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1202,7 +1175,7 @@ /**end repeat1**/ static void - at CTYPE@_multiply(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1215,7 +1188,7 @@ } static void - at CTYPE@_divide(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1229,7 +1202,7 @@ } static void - at CTYPE@_floor_divide(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_floor_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1248,7 +1221,7 @@ #OP2 = &&, ||# */ static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1265,7 +1238,7 @@ * #OP = >, >=, <, <=# */ static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1288,7 +1261,7 @@ #OP2 = &&, ||# */ static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1301,7 +1274,7 @@ /**end repeat1**/ static void - at CTYPE@_logical_xor(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1315,7 +1288,7 @@ } static void - at CTYPE@_logical_not(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1330,7 +1303,7 @@ * #OP = ||, ||, &&# **/ static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1341,7 +1314,7 @@ /**end repeat1**/ static void - at CTYPE@_square(char **args, intp *dimensions, intp *steps, void *data) + at CTYPE@_square(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1352,7 +1325,7 @@ } static void - at CTYPE@_reciprocal(char **args, intp *dimensions, intp *steps, void *data) + at CTYPE@_reciprocal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1372,16 +1345,16 @@ } static void - at CTYPE@_ones_like(char **args, intp *dimensions, intp *steps, void *data) + at CTYPE@_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { OUTPUT_LOOP { - ((@type@ *)op)[0] = ONE; - ((@type@ *)op)[1] = ZERO; + ((@type@ *)op)[0] = 1; + ((@type@ *)op)[1] = 0; } } static void - at CTYPE@_conjugate(char **args, intp *dimensions, intp *steps, void *func) { + at CTYPE@_conjugate(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; const @type@ in1i = ((@type@ *)ip1)[1]; @@ -1391,7 +1364,7 @@ } static void - at CTYPE@_absolute(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; @@ -1401,84 +1374,49 @@ } static void - at CTYPE@_sign(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { UNARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; const @type@ in1i = ((@type@ *)ip1)[1]; if (in1r > 0) { - ((@type@ *)op)[0] = ONE; + ((@type@ *)op)[0] = 1; } else if (in1r < 0) { - ((@type@ *)op)[0] = -ONE; + ((@type@ *)op)[0] = -1; } else { if (in1i > 0) { - ((@type@ *)op)[0] = ONE; + ((@type@ *)op)[0] = 1; } else if (in1i < 0) { - ((@type@ *)op)[0] = -ONE; + ((@type@ *)op)[0] = -1; } else { - ((@type@ *)op)[0] = ZERO; + ((@type@ *)op)[0] = 0; } } - ((@type@ *)op)[1] = ZERO; + ((@type@ *)op)[1] = 0; } } /**begin repeat1 * #kind = maximum, minimum# - * #OP1 = CGE, CLE# - * #OP2 = CLE, CGE# + * #OP = >, <# */ static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { const @type@ in1r = ((@type@ *)ip1)[0]; const @type@ in1i = ((@type@ *)ip1)[1]; const @type@ in2r = ((@type@ *)ip2)[0]; const @type@ in2i = ((@type@ *)ip2)[1]; - if (@OP1@(in1r, in1i, in2r, in2i)) { + if (in1r @OP@ in2r || ((in1r == in2r) && (in1i @OP@ in2i))) { ((@type@ *)op)[0] = in1r; ((@type@ *)op)[1] = in1i; } - else if (@OP2@(in1r, in1i, in2r, in2i)) { - ((@type@ *)op)[0] = in2r; - ((@type@ *)op)[1] = in2i; - } else { - ((@type@ *)op)[0] = NAN; - ((@type@ *)op)[1] = NAN; - } - } -} -/**end repeat1**/ - -/**begin repeat1 - * #kind = fmax, fmin# - * #OP1 = CGE, CLE# - */ -static void - at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) -{ - BINARY_LOOP { - const @type@ in1r = ((@type@ *)ip1)[0]; - const @type@ in1i = ((@type@ *)ip1)[1]; - const @type@ in2r = ((@type@ *)ip2)[0]; - const @type@ in2i = ((@type@ *)ip2)[1]; - if (@OP1@(in1r, in1i, in2r, in2i) || isnan(in2r) || isnan(in2i)) { - if (isnan(in1r) || isnan(in1i)) { - ((@type@ *)op)[0] = NAN; - ((@type@ *)op)[1] = NAN; - } - else { - ((@type@ *)op)[0] = in1r; - ((@type@ *)op)[1] = in1i; - } - } - else { ((@type@ *)op)[0] = in2r; ((@type@ *)op)[1] = in2i; } @@ -1487,12 +1425,6 @@ /**end repeat1**/ #define @CTYPE at _true_divide @CTYPE at _divide - -#undef CGE -#undef CLE -#undef ONE -#undef ZERO - /**end repeat**/ /* @@ -1506,7 +1438,7 @@ * #OP = EQ, NE, GT, GE, LT, LE# */ static void -OBJECT_ at kind@(char **args, intp *dimensions, intp *steps, void *func) { +OBJECT_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { PyObject *in1 = *(PyObject **)ip1; PyObject *in2 = *(PyObject **)ip2; @@ -1515,8 +1447,7 @@ } /**end repeat**/ -static void -OBJECT_sign(char **args, intp *dimensions, intp *steps, void *func) +OBJECT_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { PyObject *zero = PyInt_FromLong(0); UNARY_LOOP { @@ -1533,16 +1464,6 @@ */ -/* - ***************************************************************************** - ** SETUP UFUNCS ** - ***************************************************************************** - */ - -#include "__umath_generated.c" -#include "ufuncobject.c" -#include "__ufunc_api.c" - static PyUFuncGenericFunction frexp_functions[] = { #ifdef HAVE_FREXPF FLOAT_frexp, @@ -1564,6 +1485,7 @@ #endif }; + static PyUFuncGenericFunction ldexp_functions[] = { #ifdef HAVE_LDEXPF FLOAT_ldexp, @@ -1585,6 +1507,10 @@ }; +#include "__umath_generated.c" +#include "ufuncobject.c" +#include "__ufunc_api.c" + static double pinf_init(void) { @@ -1660,7 +1586,7 @@ METH_VARARGS, NULL}, {"geterrobj", (PyCFunction) ufunc_geterr, METH_VARARGS, NULL}, - {NULL, NULL, 0} /* sentinel */ + {NULL, NULL, 0, NULL} /* sentinel */ }; PyMODINIT_FUNC initumath(void) { Modified: branches/ufunc_cleanup/numpy/fft/fftpack_litemodule.c =================================================================== --- branches/ufunc_cleanup/numpy/fft/fftpack_litemodule.c 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/fft/fftpack_litemodule.c 2008-10-21 02:48:38 UTC (rev 5952) @@ -9,7 +9,7 @@ static char fftpack_cfftf__doc__[] = ""; PyObject * -fftpack_cfftf(PyObject *self, PyObject *args) +fftpack_cfftf(PyObject *NPY_UNUSED(self), PyObject *args) { PyObject *op1, *op2; PyArrayObject *data; @@ -60,7 +60,7 @@ static char fftpack_cfftb__doc__[] = ""; PyObject * -fftpack_cfftb(PyObject *self, PyObject *args) +fftpack_cfftb(PyObject *NPY_UNUSED(self), PyObject *args) { PyObject *op1, *op2; PyArrayObject *data; @@ -111,7 +111,7 @@ static char fftpack_cffti__doc__[] =""; static PyObject * -fftpack_cffti(PyObject *self, PyObject *args) +fftpack_cffti(PyObject *NPY_UNUSED(self), PyObject *args) { PyArrayObject *op; npy_intp dim; @@ -138,7 +138,7 @@ static char fftpack_rfftf__doc__[] =""; PyObject * -fftpack_rfftf(PyObject *self, PyObject *args) +fftpack_rfftf(PyObject *NPY_UNUSED(self), PyObject *args) { PyObject *op1, *op2; PyArrayObject *data, *ret; @@ -204,7 +204,7 @@ PyObject * -fftpack_rfftb(PyObject *self, PyObject *args) +fftpack_rfftb(PyObject *NPY_UNUSED(self), PyObject *args) { PyObject *op1, *op2; PyArrayObject *data, *ret; @@ -265,7 +265,7 @@ static char fftpack_rffti__doc__[] =""; static PyObject * -fftpack_rffti(PyObject *self, PyObject *args) +fftpack_rffti(PyObject *NPY_UNUSED(self), PyObject *args) { PyArrayObject *op; npy_intp dim; Modified: branches/ufunc_cleanup/numpy/lib/src/_compiled_base.c =================================================================== --- branches/ufunc_cleanup/numpy/lib/src/_compiled_base.c 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/lib/src/_compiled_base.c 2008-10-21 02:48:38 UTC (rev 5952) @@ -80,7 +80,7 @@ static PyObject * -arr_bincount(PyObject *self, PyObject *args, PyObject *kwds) +arr_bincount(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwds) { /* arr_bincount is registered as bincount. * bincount accepts one or two arguments. The first is an array of @@ -147,7 +147,7 @@ static PyObject * -arr_digitize(PyObject *self, PyObject *args, PyObject *kwds) +arr_digitize(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwds) { /* digitize (x, bins) returns an array of python integers the same length of x. The values i returned are such that bins [i - 1] <= x < @@ -219,7 +219,7 @@ static char arr_insert__doc__[] = "Insert vals sequentially into equivalent 1-d positions indicated by mask."; static PyObject * -arr_insert(PyObject *self, PyObject *args, PyObject *kwdict) +arr_insert(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwdict) { /* Returns input array with values inserted sequentially into places indicated by the mask @@ -379,7 +379,7 @@ } static PyObject * -arr_interp(PyObject *self, PyObject *args, PyObject *kwdict) +arr_interp(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwdict) { PyObject *fp, *xp, *x; @@ -474,7 +474,7 @@ /* Can only be called if doc is currently NULL */ static PyObject * -arr_add_docstring(PyObject *dummy, PyObject *args) +arr_add_docstring(PyObject *NPY_UNUSED(dummy), PyObject *args) { PyObject *obj; PyObject *str; @@ -624,11 +624,11 @@ static void _unpackbits( void *In, - int el_size, /* unused */ + int NPY_UNUSED(el_size), /* unused */ npy_intp in_N, npy_intp in_stride, void *Out, - npy_intp out_N, + npy_intp NPY_UNUSED(out_N), npy_intp out_stride ) { @@ -772,7 +772,7 @@ static PyObject * -io_pack(PyObject *self, PyObject *args, PyObject *kwds) +io_pack(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwds) { PyObject *obj; int axis=NPY_MAXDIMS; @@ -785,7 +785,7 @@ } static PyObject * -io_unpack(PyObject *self, PyObject *args, PyObject *kwds) +io_unpack(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwds) { PyObject *obj; int axis=NPY_MAXDIMS; Modified: branches/ufunc_cleanup/numpy/linalg/lapack_litemodule.c =================================================================== --- branches/ufunc_cleanup/numpy/linalg/lapack_litemodule.c 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/linalg/lapack_litemodule.c 2008-10-21 02:48:38 UTC (rev 5952) @@ -129,7 +129,7 @@ #define IDATA(p) ((int *) (((PyArrayObject *)p)->data)) static PyObject * -lapack_lite_dgeev(PyObject *self, PyObject *args) +lapack_lite_dgeev(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; char jobvl; @@ -169,7 +169,7 @@ } static PyObject * -lapack_lite_dsyevd(PyObject *self, PyObject *args) +lapack_lite_dsyevd(PyObject *NPY_UNUSED(self), PyObject *args) { /* Arguments */ /* ========= */ @@ -251,7 +251,7 @@ } static PyObject * -lapack_lite_zheevd(PyObject *self, PyObject *args) +lapack_lite_zheevd(PyObject *NPY_UNUSED(self), PyObject *args) { /* Arguments */ /* ========= */ @@ -339,7 +339,7 @@ } static PyObject * -lapack_lite_dgelsd(PyObject *self, PyObject *args) +lapack_lite_dgelsd(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m; @@ -378,7 +378,7 @@ } static PyObject * -lapack_lite_dgesv(PyObject *self, PyObject *args) +lapack_lite_dgesv(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int n; @@ -404,7 +404,7 @@ } static PyObject * -lapack_lite_dgesdd(PyObject *self, PyObject *args) +lapack_lite_dgesdd(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; char jobz; @@ -470,7 +470,7 @@ } static PyObject * -lapack_lite_dgetrf(PyObject *self, PyObject *args) +lapack_lite_dgetrf(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m; @@ -492,7 +492,7 @@ } static PyObject * -lapack_lite_dpotrf(PyObject *self, PyObject *args) +lapack_lite_dpotrf(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int n; @@ -512,7 +512,7 @@ } static PyObject * -lapack_lite_dgeqrf(PyObject *self, PyObject *args) +lapack_lite_dgeqrf(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m, n, lwork; @@ -538,7 +538,7 @@ static PyObject * -lapack_lite_dorgqr(PyObject *self, PyObject *args) +lapack_lite_dorgqr(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m, n, k, lwork; @@ -559,7 +559,7 @@ static PyObject * -lapack_lite_zgeev(PyObject *self, PyObject *args) +lapack_lite_zgeev(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; char jobvl; @@ -599,7 +599,7 @@ } static PyObject * -lapack_lite_zgelsd(PyObject *self, PyObject *args) +lapack_lite_zgelsd(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m; @@ -638,7 +638,7 @@ } static PyObject * -lapack_lite_zgesv(PyObject *self, PyObject *args) +lapack_lite_zgesv(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int n; @@ -664,7 +664,7 @@ } static PyObject * -lapack_lite_zgesdd(PyObject *self, PyObject *args) +lapack_lite_zgesdd(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; char jobz; @@ -706,7 +706,7 @@ } static PyObject * -lapack_lite_zgetrf(PyObject *self, PyObject *args) +lapack_lite_zgetrf(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m; @@ -728,7 +728,7 @@ } static PyObject * -lapack_lite_zpotrf(PyObject *self, PyObject *args) +lapack_lite_zpotrf(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int n; @@ -747,7 +747,7 @@ } static PyObject * -lapack_lite_zgeqrf(PyObject *self, PyObject *args) +lapack_lite_zgeqrf(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m, n, lwork; @@ -770,7 +770,7 @@ static PyObject * -lapack_lite_zungqr(PyObject *self, PyObject *args) +lapack_lite_zungqr(PyObject *NPY_UNUSED(self), PyObject *args) { int lapack_lite_status__; int m, n, k, lwork; Modified: branches/ufunc_cleanup/numpy/ma/core.py =================================================================== --- branches/ufunc_cleanup/numpy/ma/core.py 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/ma/core.py 2008-10-21 02:48:38 UTC (rev 5952) @@ -749,11 +749,20 @@ Each field is set to a bool. """ + # Make sure we do have a dtype + if not isinstance(ndtype, np.dtype): + ndtype = np.dtype(ndtype) + # Do we have some name fields ? if ndtype.names: mdescr = [list(_) for _ in ndtype.descr] for m in mdescr: m[1] = '|b1' - return [tuple(_) for _ in mdescr] + return np.dtype([tuple(_) for _ in mdescr]) + # Is this some kind of composite a la (np.float,2) + elif ndtype.subdtype: + mdescr = list(ndtype.subdtype) + mdescr[0] = np.dtype(bool) + return np.dtype(tuple(mdescr)) else: return MaskType @@ -1434,20 +1443,33 @@ return result #............................................. def view(self, dtype=None, type=None): - if dtype is not None: + if dtype is None: if type is None: - args = (dtype,) + output = ndarray.view(self) else: - args = (dtype, type) + output = ndarray.view(self, type) elif type is None: - args = () + try: + if issubclass(dtype, ndarray): + output = ndarray.view(self, dtype) + dtype = None + else: + output = ndarray.view(self, dtype) + except TypeError: + output = ndarray.view(self, dtype) else: - args = (type,) - output = ndarray.view(self, *args) + output = ndarray.view(self, dtype, type) + # Should we update the mask ? if (getattr(output,'_mask', nomask) is not nomask): - mdtype = make_mask_descr(output.dtype) + if dtype is None: + dtype = output.dtype + mdtype = make_mask_descr(dtype) + output._mask = self._mask.view(mdtype, ndarray) output._mask.shape = output.shape + # Make sure to reset the _fill_value if needed + if getattr(output, '_fill_value', None): + output._fill_value = None return output view.__doc__ = ndarray.view.__doc__ #............................................. @@ -1996,7 +2018,7 @@ # def __rmul__(self, other): "Multiply other by self, and return a new masked array." - return multiply(self, other) + return multiply(other, self) # def __div__(self, other): "Divide other into self, and return a new masked array." Modified: branches/ufunc_cleanup/numpy/ma/mrecords.py =================================================================== --- branches/ufunc_cleanup/numpy/ma/mrecords.py 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/ma/mrecords.py 2008-10-21 02:48:38 UTC (rev 5952) @@ -106,8 +106,6 @@ _fill_value : {record} Filling values for each field. """ - _defaultfieldmask = nomask - _defaulthardmask = False #............................................ def __new__(cls, shape, dtype=None, buf=None, offset=0, strides=None, formats=None, names=None, titles=None, @@ -164,7 +162,7 @@ dtype=mdescr).view(recarray) # Update some of the attributes _dict = self.__dict__ - _dict.update(_mask=_mask, _fieldmask=_mask) + _dict.update(_mask=_mask) self._update_from(obj) if _dict['_baseclass'] == ndarray: _dict['_baseclass'] = recarray @@ -201,32 +199,38 @@ if obj.dtype.fields: raise NotImplementedError("MaskedRecords is currently limited to"\ "simple records...") - obj = obj.view(MaskedArray) - obj._baseclass = ndarray - obj._isfield = True # Get some special attributes - _fill_value = _localdict.get('_fill_value', None) + # Reset the object's mask + hasmasked = False _mask = _localdict.get('_mask', None) - # Reset the object's mask if _mask is not None: try: - obj._mask = _mask[attr] + _mask = _mask[attr] except IndexError: # Couldn't find a mask: use the default (nomask) pass - # Reset the field values - if _fill_value is not None: - try: - obj._fill_value = _fill_value[attr] - except ValueError: - obj._fill_value = None + hasmasked = _mask.view((np.bool,(len(_mask.dtype) or 1))).any() + if (obj.shape or hasmasked): + obj = obj.view(MaskedArray) + obj._baseclass = ndarray + obj._isfield = True + obj._mask = _mask + # Reset the field values + _fill_value = _localdict.get('_fill_value', None) + if _fill_value is not None: + try: + obj._fill_value = _fill_value[attr] + except ValueError: + obj._fill_value = None + else: + obj = obj.item() return obj def __setattr__(self, attr, val): "Sets the attribute attr to the value val." # Should we call __setmask__ first ? - if attr in ['_mask','mask','_fieldmask','fieldmask']: + if attr in ['mask', 'fieldmask']: self.__setmask__(val) return # Create a shortcut (so that we don't have to call getattr all the time) @@ -331,18 +335,44 @@ reprstr.extend([fmt % (' fill_value', self.fill_value), ' )']) return str("\n".join(reprstr)) - #...................................................... - def view(self, obj): +# #...................................................... + def view(self, dtype=None, type=None): """Returns a view of the mrecarray.""" - try: - if issubclass(obj, ndarray): - return ndarray.view(self, obj) - except TypeError: - pass - dtype_ = np.dtype(obj) - if dtype_.fields is None: - return self.__array__().view(dtype_) - return ndarray.view(self, obj) + # OK, basic copy-paste from MaskedArray.view... + if dtype is None: + if type is None: + output = ndarray.view(self) + else: + output = ndarray.view(self, type) + # Here again... + elif type is None: + try: + if issubclass(dtype, ndarray): + output = ndarray.view(self, dtype) + dtype = None + else: + output = ndarray.view(self, dtype) + # OK, there's the change + except TypeError: + dtype = np.dtype(dtype) + # we need to revert to MaskedArray, but keeping the possibility + # ...of subclasses (eg, TimeSeriesRecords), so we'll force a type + # ...set to the first parent + if dtype.fields is None: + basetype = self.__class__.__bases__[0] + output = self.__array__().view(dtype, basetype) + output._update_from(self) + else: + output = ndarray.view(self, dtype) + output._fill_value = None + else: + output = ndarray.view(self, dtype, type) + # Update the mask, just like in MaskedArray.view + if (getattr(output,'_mask', nomask) is not nomask): + mdtype = ma.make_mask_descr(output.dtype) + output._mask = self._mask.view(mdtype, ndarray) + output._mask.shape = output.shape + return output def harden_mask(self): "Forces the mask to hard" @@ -355,7 +385,7 @@ """Returns a copy of the masked record.""" _localdict = self.__dict__ copied = self._data.copy().view(type(self)) - copied._fieldmask = self._fieldmask.copy() + copied._mask = self._mask.copy() return copied def tolist(self, fill_value=None): @@ -371,7 +401,7 @@ if fill_value is not None: return self.filled(fill_value).tolist() result = narray(self.filled().tolist(), dtype=object) - mask = narray(self._fieldmask.tolist()) + mask = narray(self._mask.tolist()) result[mask] = None return result.tolist() #-------------------------------------------- @@ -385,7 +415,7 @@ self.dtype, self.flags.fnc, self._data.tostring(), - self._fieldmask.tostring(), + self._mask.tostring(), self._fill_value, ) return state @@ -405,7 +435,7 @@ (ver, shp, typ, isf, raw, msk, flv) = state ndarray.__setstate__(self, (shp, typ, isf, raw)) mdtype = dtype([(k,bool_) for (k,_) in self.dtype.descr]) - self.__dict__['_fieldmask'].__setstate__((shp, mdtype, isf, msk)) + self.__dict__['_mask'].__setstate__((shp, mdtype, isf, msk)) self.fill_value = flv # def __reduce__(self): @@ -508,7 +538,7 @@ Lists of tuples should be preferred over lists of lists for faster processing. """ # Grab the initial _fieldmask, if needed: - _fieldmask = getattr(reclist, '_fieldmask', None) + _mask = getattr(reclist, '_mask', None) # Get the list of records..... try: nfields = len(reclist[0]) @@ -533,13 +563,13 @@ mask = np.array(mask, copy=False) maskrecordlength = len(mask.dtype) if maskrecordlength: - mrec._fieldmask.flat = mask + mrec._mask.flat = mask elif len(mask.shape) == 2: - mrec._fieldmask.flat = [tuple(m) for m in mask] + mrec._mask.flat = [tuple(m) for m in mask] else: - mrec._mask = mask - if _fieldmask is not None: - mrec._fieldmask[:] = _fieldmask + mrec.__setmask__(mask) + if _mask is not None: + mrec._mask[:] = _mask return mrec def _guessvartypes(arr): @@ -680,5 +710,5 @@ # Add the mask of the new field newmask.setfield(getmaskarray(newfield), *newmask.dtype.fields[newfieldname]) - newdata._fieldmask = newmask + newdata._mask = newmask return newdata Modified: branches/ufunc_cleanup/numpy/ma/tests/test_core.py =================================================================== --- branches/ufunc_cleanup/numpy/ma/tests/test_core.py 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/ma/tests/test_core.py 2008-10-21 02:48:38 UTC (rev 5952) @@ -2270,6 +2270,21 @@ self.failUnless(c[0,0] is masked) self.failUnless(c.flags['C']) + + def test_make_mask_descr(self): + "Test make_mask_descr" + ntype = [('a',np.float), ('b',np.float)] + test = make_mask_descr(ntype) + assert_equal(test, [('a',np.bool),('b',np.bool)]) + # + ntype = (np.float, 2) + test = make_mask_descr(ntype) + assert_equal(test, (np.bool,2)) + # + ntype = np.float + test = make_mask_descr(ntype) + assert_equal(test, np.dtype(np.bool)) + #------------------------------------------------------------------------------ class TestMaskedFields(TestCase): @@ -2361,23 +2376,15 @@ a = array(iterator, dtype=[('a',float),('b',float)]) a.mask[0] = (1,0) controlmask = np.array([1]+19*[0], dtype=bool) - # + # Transform globally to simple dtype test = a.view(float) assert_equal(test, data.ravel()) assert_equal(test.mask, controlmask) - # + # Transform globally to dty test = a.view((float,2)) assert_equal(test, data) assert_equal(test.mask, controlmask.reshape(-1,2)) # - test = a.view([('A',float),('B',float)]) - assert_equal(test.mask.dtype.names, ('A', 'B')) - assert_equal(test['A'], a['a']) - assert_equal(test['B'], a['b']) - # - test = a.view(np.ndarray) - assert_equal(test, a._data) - # test = a.view((float,2), np.matrix) assert_equal(test, data) self.failUnless(isinstance(test, np.matrix)) @@ -2399,6 +2406,86 @@ assert_equal_records(a[-2]._data, a._data[-2]) assert_equal_records(a[-2]._mask, a._mask[-2]) + +class TestMaskedView(TestCase): + # + def setUp(self): + iterator = zip(np.arange(10), np.random.rand(10)) + data = np.array(iterator) + a = array(iterator, dtype=[('a',float),('b',float)]) + a.mask[0] = (1,0) + controlmask = np.array([1]+19*[0], dtype=bool) + self.data = (data, a, controlmask) + # + def test_view_to_nothing(self): + (data, a, controlmask) = self.data + test = a.view() + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test._data, a._data) + assert_equal(test._mask, a._mask) + + # + def test_view_to_type(self): + (data, a, controlmask) = self.data + test = a.view(np.ndarray) + self.failUnless(not isinstance(test, MaskedArray)) + assert_equal(test, a._data) + assert_equal_records(test, data.view(a.dtype).squeeze()) + # + def test_view_to_simple_dtype(self): + (data, a, controlmask) = self.data + # View globally + test = a.view(float) + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test, data.ravel()) + assert_equal(test.mask, controlmask) + # + def test_view_to_flexible_dtype(self): + (data, a, controlmask) = self.data + # + test = a.view([('A',float),('B',float)]) + assert_equal(test.mask.dtype.names, ('A', 'B')) + assert_equal(test['A'], a['a']) + assert_equal(test['B'], a['b']) + # + test = a[0].view([('A',float),('B',float)]) + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test.mask.dtype.names, ('A', 'B')) + assert_equal(test['A'], a['a'][0]) + assert_equal(test['B'], a['b'][0]) + # + test = a[-1].view([('A',float),('B',float)]) + self.failUnless(not isinstance(test, MaskedArray)) + assert_equal(test.dtype.names, ('A', 'B')) + assert_equal(test['A'], a['a'][-1]) + assert_equal(test['B'], a['b'][-1]) + + # + def test_view_to_subdtype(self): + (data, a, controlmask) = self.data + # View globally + test = a.view((float,2)) + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test, data) + assert_equal(test.mask, controlmask.reshape(-1,2)) + # View on 1 masked element + test = a[0].view((float,2)) + self.failUnless(isinstance(test, MaskedArray)) + assert_equal(test, data[0]) + assert_equal(test.mask, (1,0)) + # View on 1 unmasked element + test = a[-1].view((float,2)) + self.failUnless(not isinstance(test, MaskedArray)) + assert_equal(test, data[-1]) + # + def test_view_to_dtype_and_type(self): + (data, a, controlmask) = self.data + # + test = a.view((float,2), np.matrix) + assert_equal(test, data) + self.failUnless(isinstance(test, np.matrix)) + self.failUnless(not isinstance(test, MaskedArray)) + ############################################################################### #------------------------------------------------------------------------------ if __name__ == "__main__": Modified: branches/ufunc_cleanup/numpy/ma/tests/test_mrecords.py =================================================================== --- branches/ufunc_cleanup/numpy/ma/tests/test_mrecords.py 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/ma/tests/test_mrecords.py 2008-10-21 02:48:38 UTC (rev 5952) @@ -65,8 +65,6 @@ assert_equal(mbase_first.tolist(), (1,1.1,'one')) # Used to be mask, now it's recordmask assert_equal(mbase_first.recordmask, nomask) - # _fieldmask and _mask should be the same thing - assert_equal(mbase_first._fieldmask.item(), (False, False, False)) assert_equal(mbase_first._mask.item(), (False, False, False)) assert_equal(mbase_first['a'], mbase['a'][0]) mbase_last = mbase[-1] @@ -75,7 +73,7 @@ assert_equal(mbase_last.tolist(), (None,None,None)) # Used to be mask, now it's recordmask assert_equal(mbase_last.recordmask, True) - assert_equal(mbase_last._fieldmask.item(), (True, True, True)) + assert_equal(mbase_last._mask.item(), (True, True, True)) assert_equal(mbase_last['a'], mbase['a'][-1]) assert (mbase_last['a'] is masked) # as slice .......... @@ -107,7 +105,7 @@ assert_equal(ma.getmaskarray(mbase['a']), [0]*5) # Use to be _mask, now it's recordmask assert_equal(mbase.recordmask, [False]*5) - assert_equal(mbase._fieldmask.tolist(), + assert_equal(mbase._mask.tolist(), np.array([(0,0,0),(0,1,1),(0,0,0),(0,0,0),(0,1,1)], dtype=bool)) # Set a field to mask ........................ @@ -117,7 +115,7 @@ assert_equal(mbase.c.recordmask, [1]*5) assert_equal(ma.getmaskarray(mbase['c']), [1]*5) assert_equal(ma.getdata(mbase['c']), ['N/A']*5) - assert_equal(mbase._fieldmask.tolist(), + assert_equal(mbase._mask.tolist(), np.array([(0,0,1),(0,1,1),(0,0,1),(0,0,1),(0,1,1)], dtype=bool)) # Set fields by slices ....................... @@ -159,23 +157,23 @@ base = self.base.copy() mbase = base.view(mrecarray) # Set the mask to True ....................... - mbase._mask = masked + mbase.mask = masked assert_equal(ma.getmaskarray(mbase['b']), [1]*5) assert_equal(mbase['a']._mask, mbase['b']._mask) assert_equal(mbase['a']._mask, mbase['c']._mask) - assert_equal(mbase._fieldmask.tolist(), + assert_equal(mbase._mask.tolist(), np.array([(1,1,1)]*5, dtype=bool)) # Delete the mask ............................ - mbase._mask = nomask + mbase.mask = nomask assert_equal(ma.getmaskarray(mbase['c']), [0]*5) - assert_equal(mbase._fieldmask.tolist(), + assert_equal(mbase._mask.tolist(), np.array([(0,0,0)]*5, dtype=bool)) # def test_set_mask_fromarray(self): base = self.base.copy() mbase = base.view(mrecarray) # Sets the mask w/ an array - mbase._mask = [1,0,0,0,1] + mbase.mask = [1,0,0,0,1] assert_equal(mbase.a.mask, [1,0,0,0,1]) assert_equal(mbase.b.mask, [1,0,0,0,1]) assert_equal(mbase.c.mask, [1,0,0,0,1]) @@ -206,7 +204,7 @@ # Set an element to mask ..................... mbase = base.view(mrecarray).copy() mbase[-2] = masked - assert_equal(mbase._fieldmask.tolist(), + assert_equal(mbase._mask.tolist(), np.array([(0,0,0),(1,1,1),(0,0,0),(1,1,1),(1,1,1)], dtype=bool)) # Used to be mask, now it's recordmask! @@ -265,11 +263,11 @@ mbase = base.view(mrecarray) mbase.harden_mask() self.failUnless(mbase._hardmask) - mbase._mask = nomask + mbase.mask = nomask assert_equal_records(mbase._mask, base._mask) mbase.soften_mask() self.failUnless(not mbase._hardmask) - mbase._mask = nomask + mbase.mask = nomask # So, the mask of a field is no longer set to nomask... assert_equal_records(mbase._mask, ma.make_mask_none(base.shape,base.dtype)) @@ -286,7 +284,7 @@ assert_equal(mrec_.dtype, mrec.dtype) assert_equal_records(mrec_._data, mrec._data) assert_equal(mrec_._mask, mrec._mask) - assert_equal_records(mrec_._fieldmask, mrec._fieldmask) + assert_equal_records(mrec_._mask, mrec._mask) # def test_filled(self): "Test filling the array" @@ -340,6 +338,45 @@ np.array([(0,0,0),(1,1,1)], dtype=mult.dtype)) +class TestView(TestCase): + # + def setUp(self): + (a, b) = (np.arange(10), np.random.rand(10)) + ndtype = [('a',np.float), ('b',np.float)] + arr = np.array(zip(a,b), dtype=ndtype) + rec = arr.view(np.recarray) + # + marr = ma.array(zip(a,b), dtype=ndtype, fill_value=(-9., -99.)) + mrec = fromarrays([a,b], dtype=ndtype, fill_value=(-9., -99.)) + mrec.mask[3] = (False, True) + self.data = (mrec, a, b, arr) + # + def test_view_by_itself(self): + (mrec, a, b, arr) = self.data + test = mrec.view() + self.failUnless(isinstance(test, MaskedRecords)) + assert_equal_records(test, mrec) + assert_equal_records(test._mask, mrec._mask) + # + def test_view_simple_dtype(self): + (mrec, a, b, arr) = self.data + ntype = (np.float, 2) + test = mrec.view(ntype) + self.failUnless(isinstance(test, ma.MaskedArray)) + assert_equal(test, np.array(zip(a,b), dtype=np.float)) + self.failUnless(test[3,1] is ma.masked) + # + def test_view_flexible_type(self): + (mrec, a, b, arr) = self.data + alttype = [('A',np.float), ('B',np.float)] + test = mrec.view(alttype) + self.failUnless(isinstance(test, MaskedRecords)) + assert_equal_records(test, arr.view(alttype)) + self.failUnless(test['B'][3] is masked) + assert_equal(test.dtype, np.dtype(alttype)) + self.failUnless(test._fill_value is None) + + ################################################################################ class TestMRecordsImport(TestCase): "Base test class for MaskedArrays." @@ -395,7 +432,7 @@ _mrec = fromrecords(mrec) assert_equal(_mrec.dtype, mrec.dtype) assert_equal_records(_mrec._data, mrec.filled()) - assert_equal_records(_mrec._fieldmask, mrec._fieldmask) + assert_equal_records(_mrec._mask, mrec._mask) def test_fromrecords_wmask(self): "Tests construction from records w/ mask." @@ -403,20 +440,20 @@ # _mrec = fromrecords(nrec.tolist(), dtype=ddtype, mask=[0,1,0,]) assert_equal_records(_mrec._data, mrec._data) - assert_equal(_mrec._fieldmask.tolist(), [(0,0,0),(1,1,1),(0,0,0)]) + assert_equal(_mrec._mask.tolist(), [(0,0,0),(1,1,1),(0,0,0)]) # _mrec = fromrecords(nrec.tolist(), dtype=ddtype, mask=True) assert_equal_records(_mrec._data, mrec._data) - assert_equal(_mrec._fieldmask.tolist(), [(1,1,1),(1,1,1),(1,1,1)]) + assert_equal(_mrec._mask.tolist(), [(1,1,1),(1,1,1),(1,1,1)]) # - _mrec = fromrecords(nrec.tolist(), dtype=ddtype, mask=mrec._fieldmask) + _mrec = fromrecords(nrec.tolist(), dtype=ddtype, mask=mrec._mask) assert_equal_records(_mrec._data, mrec._data) - assert_equal(_mrec._fieldmask.tolist(), mrec._fieldmask.tolist()) + assert_equal(_mrec._mask.tolist(), mrec._mask.tolist()) # _mrec = fromrecords(nrec.tolist(), dtype=ddtype, - mask=mrec._fieldmask.tolist()) + mask=mrec._mask.tolist()) assert_equal_records(_mrec._data, mrec._data) - assert_equal(_mrec._fieldmask.tolist(), mrec._fieldmask.tolist()) + assert_equal(_mrec._mask.tolist(), mrec._mask.tolist()) def test_fromtextfile(self): "Tests reading from a text file." Modified: branches/ufunc_cleanup/numpy/ma/tests/test_subclassing.py =================================================================== --- branches/ufunc_cleanup/numpy/ma/tests/test_subclassing.py 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/ma/tests/test_subclassing.py 2008-10-21 02:48:38 UTC (rev 5952) @@ -154,24 +154,4 @@ if __name__ == '__main__': run_module_suite() - if 0: - x = array(arange(5), mask=[0]+[1]*4) - my = masked_array(subarray(x)) - ym = msubarray(x) - # - z = (my+1) - self.failUnless(isinstance(z,MaskedArray)) - self.failUnless(not isinstance(z, MSubArray)) - self.failUnless(isinstance(z._data, SubArray)) - assert_equal(z._data.info, {}) - # - z = (ym+1) - self.failUnless(isinstance(z, MaskedArray)) - self.failUnless(isinstance(z, MSubArray)) - self.failUnless(isinstance(z._data, SubArray)) - self.failUnless(z._data.info['added'] > 0) - # - ym._set_mask([1,0,0,0,1]) - assert_equal(ym._mask, [1,0,0,0,1]) - ym._series._set_mask([0,0,0,0,1]) - assert_equal(ym._mask, [0,0,0,0,1]) + Modified: branches/ufunc_cleanup/numpy/numarray/_capi.c =================================================================== --- branches/ufunc_cleanup/numpy/numarray/_capi.c 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/numarray/_capi.c 2008-10-21 02:48:38 UTC (rev 5952) @@ -225,7 +225,7 @@ ** should always be 0 * */ -static int int_dividebyzero_error(long value, long unused) { +static int int_dividebyzero_error(long NPY_UNUSED(value), long NPY_UNUSED(unused)) { double dummy; dummy = 1./numarray_zero; if (dummy) /* to prevent optimizer from eliminating expression */ @@ -876,7 +876,7 @@ cfunc and wrapper. */ static PyObject * -cfunc_call(PyObject *self, PyObject *argsTuple, PyObject *argsDict) +cfunc_call(PyObject *self, PyObject *argsTuple, PyObject *NPY_UNUSED(argsDict)) { CfuncObject *me = (CfuncObject *) self; switch(me->descr.type) { @@ -2546,9 +2546,9 @@ NA_callStrideConvCFuncCore( PyObject *self, int nshape, maybelong *shape, PyObject *inbuffObj, long inboffset, - int ninbstrides, maybelong *inbstrides, + int NPY_UNUSED(ninbstrides), maybelong *inbstrides, PyObject *outbuffObj, long outboffset, - int noutbstrides, maybelong *outbstrides, + int NPY_UNUSED(noutbstrides), maybelong *outbstrides, long nbytes) { CfuncObject *me = (CfuncObject *) self; @@ -2627,17 +2627,17 @@ } static int -NA_OperatorCheck(PyObject *op) { +NA_OperatorCheck(PyObject *NPY_UNUSED(op)) { return 0; } static int -NA_ConverterCheck(PyObject *op) { +NA_ConverterCheck(PyObject *NPY_UNUSED(op)) { return 0; } static int -NA_UfuncCheck(PyObject *op) { +NA_UfuncCheck(PyObject *NPY_UNUSED(op)) { return 0; } @@ -2647,8 +2647,8 @@ } static int -NA_getByteOffset(PyArrayObject *array, int nindices, maybelong *indices, - long *offset) +NA_getByteOffset(PyArrayObject *NPY_UNUSED(array), int NPY_UNUSED(nindices), + maybelong *NPY_UNUSED(indices), long *NPY_UNUSED(offset)) { return 0; } @@ -2742,8 +2742,9 @@ /* ignores bytestride */ static PyArrayObject * NA_NewAllFromBuffer(int ndim, maybelong *shape, NumarrayType type, - PyObject *bufferObject, maybelong byteoffset, maybelong bytestride, - int byteorder, int aligned, int writeable) + PyObject *bufferObject, maybelong byteoffset, + maybelong NPY_UNUSED(bytestride), int byteorder, + int NPY_UNUSED(aligned), int NPY_UNUSED(writeable)) { PyArrayObject *self = NULL; PyArray_Descr *dtype; @@ -2822,17 +2823,17 @@ } static int -NA_OperatorCheckExact(PyObject *op) { +NA_OperatorCheckExact(PyObject *NPY_UNUSED(op)) { return 0; } static int -NA_ConverterCheckExact(PyObject *op) { +NA_ConverterCheckExact(PyObject *NPY_UNUSED(op)) { return 0; } static int -NA_UfuncCheckExact(PyObject *op) { +NA_UfuncCheckExact(PyObject *NPY_UNUSED(op)) { return 0; } @@ -2854,7 +2855,7 @@ /* Byteswap is not a flag of the array --- it is implicit in the data-type */ static void -NA_updateByteswap(PyArrayObject *self) +NA_updateByteswap(PyArrayObject *NPY_UNUSED(self)) { return; } Modified: branches/ufunc_cleanup/numpy/testing/utils.py =================================================================== --- branches/ufunc_cleanup/numpy/testing/utils.py 2008-10-20 21:57:01 UTC (rev 5951) +++ branches/ufunc_cleanup/numpy/testing/utils.py 2008-10-21 02:48:38 UTC (rev 5952) @@ -8,19 +8,14 @@ import operator from nosetester import import_nose -__all__ = ['assert_', 'assert_equal', 'assert_almost_equal', - 'assert_approx_equal', 'assert_array_equal', 'assert_array_less', - 'assert_string_equal', 'assert_array_almost_equal', 'assert_raises', - 'build_err_msg', 'decorate_methods', 'jiffies', 'memusage', - 'print_assert_equal', 'raises', 'rand', 'rundocs', 'runstring', - 'verbose'] +__all__ = ['assert_equal', 'assert_almost_equal','assert_approx_equal', + 'assert_array_equal', 'assert_array_less', 'assert_string_equal', + 'assert_array_almost_equal', 'assert_raises', 'build_err_msg', + 'decorate_methods', 'jiffies', 'memusage', 'print_assert_equal', + 'raises', 'rand', 'rundocs', 'runstring', 'verbose'] verbose = 0 -def assert_(test, message=""): - if not test: - raise AssertionError(message) - def rand(*args): """Returns an array of random numbers with the given shape. From numpy-svn at scipy.org Tue Oct 21 00:49:46 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 20 Oct 2008 23:49:46 -0500 (CDT) Subject: [Numpy-svn] r5953 - branches/ufunc_cleanup/numpy/core/src Message-ID: <20081021044946.E332439C0EA@scipy.org> Author: charris Date: 2008-10-20 23:49:44 -0500 (Mon, 20 Oct 2008) New Revision: 5953 Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src Log: Put back fmin, fmax lost in merge. Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-21 02:48:38 UTC (rev 5952) +++ branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-21 04:49:44 UTC (rev 5953) @@ -654,7 +654,7 @@ { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; - *((@s@@type@ *)op) = 1.0/in1; + *((@s@@type@ *)op) = (@s@@type@)(1.0/in1); } } @@ -924,6 +924,9 @@ * #C = F, , L# */ +#define ONE 1.0 at c@ +#define ZERO 0.0 at c@ + /**begin repeat1 * Arithmetic * # kind = add, subtract, multiply, divide# @@ -991,7 +994,7 @@ /**begin repeat1 * #kind = maximum, minimum# - * #OP = >, <# + * #OP = >=, <=# **/ static void @TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) @@ -1000,12 +1003,28 @@ BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; const @type@ in2 = *(@type@ *)ip2; - *((@type@ *)op) = in1 @OP@ in2 ? in1 : in2; + *((@type@ *)op) = (in1 @OP@ in2 || isnan(in1)) ? in1 : in2; } } /**end repeat1**/ +/**begin repeat1 + * #kind = fmax, fmin# + * #OP = >=, <=# + **/ static void + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +{ + /* */ + BINARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + const @type@ in2 = *(@type@ *)ip2; + *((@type@ *)op) = (in1 @OP@ in2 || isnan(in2)) ? in1 : in2; + } +} +/**end repeat1**/ + +static void @TYPE at _floor_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { @@ -1045,7 +1064,7 @@ { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; - *((@type@ *)op) = 1.0/in1; + *((@type@ *)op) = ONE/in1; } } @@ -1053,7 +1072,7 @@ @TYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { OUTPUT_LOOP { - *((@type@ *)op) = 1; + *((@type@ *)op) = ONE; } } @@ -1071,7 +1090,7 @@ { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; - const @type@ tmp = (in1 > 0) ? in1 : -in1; + const @type@ tmp = in1 > 0 ? in1 : -in1; /* add 0 to clear -0.0 */ *((@type@ *)op) = tmp + 0; } @@ -1138,6 +1157,9 @@ #define @TYPE at _true_divide @TYPE at _divide +#undef ONE +#undef ZERO + /**end repeat**/ @@ -1155,6 +1177,11 @@ * #c = f, , l# */ +#define CGE(xr,xi,yr,yi) (xr > yr || (xr == yr && xi >= yi)) +#define CLE(xr,xi,yr,yi) (xr < yr || (xr == yr && xi <= yi)) +#define ONE 1.0 at c@ +#define ZERO 0.0 at c@ + /**begin repeat1 * arithmetic * #kind = add, subtract# @@ -1348,8 +1375,8 @@ @CTYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { OUTPUT_LOOP { - ((@type@ *)op)[0] = 1; - ((@type@ *)op)[1] = 0; + ((@type@ *)op)[0] = ONE; + ((@type@ *)op)[1] = ZERO; } } @@ -1380,29 +1407,30 @@ const @type@ in1r = ((@type@ *)ip1)[0]; const @type@ in1i = ((@type@ *)ip1)[1]; if (in1r > 0) { - ((@type@ *)op)[0] = 1; + ((@type@ *)op)[0] = ONE; } else if (in1r < 0) { - ((@type@ *)op)[0] = -1; + ((@type@ *)op)[0] = -ONE; } else { if (in1i > 0) { - ((@type@ *)op)[0] = 1; + ((@type@ *)op)[0] = ONE; } else if (in1i < 0) { - ((@type@ *)op)[0] = -1; + ((@type@ *)op)[0] = -ONE; } else { - ((@type@ *)op)[0] = 0; + ((@type@ *)op)[0] = ZERO; } } - ((@type@ *)op)[1] = 0; + ((@type@ *)op)[1] = ZERO; } } /**begin repeat1 * #kind = maximum, minimum# - * #OP = >, <# + * #OP1 = CGE, CLE# + * #OP2 = CLE, CGE# */ static void @CTYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) @@ -1412,11 +1440,45 @@ const @type@ in1i = ((@type@ *)ip1)[1]; const @type@ in2r = ((@type@ *)ip2)[0]; const @type@ in2i = ((@type@ *)ip2)[1]; - if (in1r @OP@ in2r || ((in1r == in2r) && (in1i @OP@ in2i))) { + if (@OP1@(in1r, in1i, in2r, in2i)) { ((@type@ *)op)[0] = in1r; ((@type@ *)op)[1] = in1i; } + else if (@OP2@(in1r, in1i, in2r, in2i)) { + ((@type@ *)op)[0] = in2r; + ((@type@ *)op)[1] = in2i; + } else { + ((@type@ *)op)[0] = NAN; + ((@type@ *)op)[1] = NAN; + } + } +} +/**end repeat1**/ + +/**begin repeat1 + * #kind = fmax, fmin# + * #OP1 = CGE, CLE# + */ +static void + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +{ + BINARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + const @type@ in2r = ((@type@ *)ip2)[0]; + const @type@ in2i = ((@type@ *)ip2)[1]; + if (@OP1@(in1r, in1i, in2r, in2i) || isnan(in2r) || isnan(in2i)) { + if (isnan(in1r) || isnan(in1i)) { + ((@type@ *)op)[0] = NAN; + ((@type@ *)op)[1] = NAN; + } + else { + ((@type@ *)op)[0] = in1r; + ((@type@ *)op)[1] = in1i; + } + } + else { ((@type@ *)op)[0] = in2r; ((@type@ *)op)[1] = in2i; } @@ -1425,6 +1487,12 @@ /**end repeat1**/ #define @CTYPE at _true_divide @CTYPE at _divide + +#undef CGE +#undef CLE +#undef ONE +#undef ZERO + /**end repeat**/ /* @@ -1464,6 +1532,16 @@ */ +/* + ***************************************************************************** + ** SETUP UFUNCS ** + ***************************************************************************** + */ + +#include "__umath_generated.c" +#include "ufuncobject.c" +#include "__ufunc_api.c" + static PyUFuncGenericFunction frexp_functions[] = { #ifdef HAVE_FREXPF FLOAT_frexp, @@ -1485,7 +1563,6 @@ #endif }; - static PyUFuncGenericFunction ldexp_functions[] = { #ifdef HAVE_LDEXPF FLOAT_ldexp, @@ -1507,10 +1584,6 @@ }; -#include "__umath_generated.c" -#include "ufuncobject.c" -#include "__ufunc_api.c" - static double pinf_init(void) { From numpy-svn at scipy.org Tue Oct 21 16:13:22 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 21 Oct 2008 15:13:22 -0500 (CDT) Subject: [Numpy-svn] r5954 - in trunk/numpy/core: code_generators src tests Message-ID: <20081021201322.823E939C089@scipy.org> Author: charris Date: 2008-10-21 15:13:17 -0500 (Tue, 21 Oct 2008) New Revision: 5954 Modified: trunk/numpy/core/code_generators/generate_umath.py trunk/numpy/core/src/umathmodule.c.src trunk/numpy/core/tests/test_umath.py Log: Change way maximum and minimum deal with nans. Add ufuncs fmax and fmin. In the following, a complex number is considered a nan if the real or imaginary part is nan. This means that there are many different complex numbers that are nans and this effects the nan values returned by the maximum, minimum, fmax, and fmin ufuncs. The maximum and minimum ufuncs are the same as before unless nans are involved. In the case of nans, if both values being compared are nans, then the first is returned, otherwise the nan value is returned. This has the effect of propagating nans. The fmax and fmin ufuncs return the same values as maximum and minimum if neither value being compared is nan. In the case of nans, if both values being compared are nans, then the first is returned, otherwise the non-nan value is returned. This has the effect that nans are ignored unless both values are nan. Modified: trunk/numpy/core/code_generators/generate_umath.py =================================================================== --- trunk/numpy/core/code_generators/generate_umath.py 2008-10-21 04:49:44 UTC (rev 5953) +++ trunk/numpy/core/code_generators/generate_umath.py 2008-10-21 20:13:17 UTC (rev 5954) @@ -316,6 +316,16 @@ TD(noobj), TD(O, f='_npy_ObjectMin') ), +'fmax' : + Ufunc(2, 1, None, + "", + TD(inexact) + ), +'fmin' : + Ufunc(2, 1, None, + "", + TD(inexact) + ), 'bitwise_and' : Ufunc(2, 1, One, docstrings.get('numpy.core.umath.bitwise_and'), Modified: trunk/numpy/core/src/umathmodule.c.src =================================================================== --- trunk/numpy/core/src/umathmodule.c.src 2008-10-21 04:49:44 UTC (rev 5953) +++ trunk/numpy/core/src/umathmodule.c.src 2008-10-21 20:13:17 UTC (rev 5954) @@ -654,7 +654,7 @@ { UNARY_LOOP { const @s@@type@ in1 = *(@s@@type@ *)ip1; - *((@s@@type@ *)op) = 1.0/in1; + *((@s@@type@ *)op) = (@s@@type@)(1.0/in1); } } @@ -924,6 +924,9 @@ * #C = F, , L# */ +#define ONE 1.0 at c@ +#define ZERO 0.0 at c@ + /**begin repeat1 * Arithmetic * # kind = add, subtract, multiply, divide# @@ -991,7 +994,7 @@ /**begin repeat1 * #kind = maximum, minimum# - * #OP = >, <# + * #OP = >=, <=# **/ static void @TYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) @@ -1000,12 +1003,28 @@ BINARY_LOOP { const @type@ in1 = *(@type@ *)ip1; const @type@ in2 = *(@type@ *)ip2; - *((@type@ *)op) = in1 @OP@ in2 ? in1 : in2; + *((@type@ *)op) = (in1 @OP@ in2 || isnan(in1)) ? in1 : in2; } } /**end repeat1**/ +/**begin repeat1 + * #kind = fmax, fmin# + * #OP = >=, <=# + **/ static void + at TYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +{ + /* */ + BINARY_LOOP { + const @type@ in1 = *(@type@ *)ip1; + const @type@ in2 = *(@type@ *)ip2; + *((@type@ *)op) = (in1 @OP@ in2 || isnan(in2)) ? in1 : in2; + } +} +/**end repeat1**/ + +static void @TYPE at _floor_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { BINARY_LOOP { @@ -1045,7 +1064,7 @@ { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; - *((@type@ *)op) = 1.0/in1; + *((@type@ *)op) = ONE/in1; } } @@ -1053,7 +1072,7 @@ @TYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { OUTPUT_LOOP { - *((@type@ *)op) = 1; + *((@type@ *)op) = ONE; } } @@ -1071,7 +1090,7 @@ { UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; - const @type@ tmp = (in1 > 0) ? in1 : -in1; + const @type@ tmp = in1 > 0 ? in1 : -in1; /* add 0 to clear -0.0 */ *((@type@ *)op) = tmp + 0; } @@ -1138,6 +1157,9 @@ #define @TYPE at _true_divide @TYPE at _divide +#undef ONE +#undef ZERO + /**end repeat**/ @@ -1155,6 +1177,11 @@ * #c = f, , l# */ +#define CGE(xr,xi,yr,yi) (xr > yr || (xr == yr && xi >= yi)) +#define CLE(xr,xi,yr,yi) (xr < yr || (xr == yr && xi <= yi)) +#define ONE 1.0 at c@ +#define ZERO 0.0 at c@ + /**begin repeat1 * arithmetic * #kind = add, subtract# @@ -1348,8 +1375,8 @@ @CTYPE at _ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) { OUTPUT_LOOP { - ((@type@ *)op)[0] = 1; - ((@type@ *)op)[1] = 0; + ((@type@ *)op)[0] = ONE; + ((@type@ *)op)[1] = ZERO; } } @@ -1380,29 +1407,30 @@ const @type@ in1r = ((@type@ *)ip1)[0]; const @type@ in1i = ((@type@ *)ip1)[1]; if (in1r > 0) { - ((@type@ *)op)[0] = 1; + ((@type@ *)op)[0] = ONE; } else if (in1r < 0) { - ((@type@ *)op)[0] = -1; + ((@type@ *)op)[0] = -ONE; } else { if (in1i > 0) { - ((@type@ *)op)[0] = 1; + ((@type@ *)op)[0] = ONE; } else if (in1i < 0) { - ((@type@ *)op)[0] = -1; + ((@type@ *)op)[0] = -ONE; } else { - ((@type@ *)op)[0] = 0; + ((@type@ *)op)[0] = ZERO; } } - ((@type@ *)op)[1] = 0; + ((@type@ *)op)[1] = ZERO; } } /**begin repeat1 * #kind = maximum, minimum# - * #OP = >, <# + * #OP1 = CGE, CLE# + * #OP2 = CLE, CGE# */ static void @CTYPE at _@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) @@ -1412,7 +1440,7 @@ const @type@ in1i = ((@type@ *)ip1)[1]; const @type@ in2r = ((@type@ *)ip2)[0]; const @type@ in2i = ((@type@ *)ip2)[1]; - if (in1r @OP@ in2r || ((in1r == in2r) && (in1i @OP@ in2i))) { + if (@OP1@(in1r, in1i, in2r, in2i) || isnan(in1r) || isnan(in1i)) { ((@type@ *)op)[0] = in1r; ((@type@ *)op)[1] = in1i; } @@ -1424,7 +1452,37 @@ } /**end repeat1**/ +/**begin repeat1 + * #kind = fmax, fmin# + * #OP1 = CGE, CLE# + */ +static void + at CTYPE@_ at kind@(char **args, intp *dimensions, intp *steps, void *func) +{ + BINARY_LOOP { + const @type@ in1r = ((@type@ *)ip1)[0]; + const @type@ in1i = ((@type@ *)ip1)[1]; + const @type@ in2r = ((@type@ *)ip2)[0]; + const @type@ in2i = ((@type@ *)ip2)[1]; + if (@OP1@(in1r, in1i, in2r, in2i) || isnan(in2r) || isnan(in2i)) { + ((@type@ *)op)[0] = in1r; + ((@type@ *)op)[1] = in1i; + } + else { + ((@type@ *)op)[0] = in2r; + ((@type@ *)op)[1] = in2i; + } + } +} +/**end repeat1**/ + #define @CTYPE at _true_divide @CTYPE at _divide + +#undef CGE +#undef CLE +#undef ONE +#undef ZERO + /**end repeat**/ /* @@ -1447,6 +1505,7 @@ } /**end repeat**/ +static void OBJECT_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { PyObject *zero = PyInt_FromLong(0); @@ -1464,6 +1523,16 @@ */ +/* + ***************************************************************************** + ** SETUP UFUNCS ** + ***************************************************************************** + */ + +#include "__umath_generated.c" +#include "ufuncobject.c" +#include "__ufunc_api.c" + static PyUFuncGenericFunction frexp_functions[] = { #ifdef HAVE_FREXPF FLOAT_frexp, @@ -1485,7 +1554,6 @@ #endif }; - static PyUFuncGenericFunction ldexp_functions[] = { #ifdef HAVE_LDEXPF FLOAT_ldexp, @@ -1507,10 +1575,6 @@ }; -#include "__umath_generated.c" -#include "ufuncobject.c" -#include "__ufunc_api.c" - static double pinf_init(void) { Modified: trunk/numpy/core/tests/test_umath.py =================================================================== --- trunk/numpy/core/tests/test_umath.py 2008-10-21 04:49:44 UTC (rev 5953) +++ trunk/numpy/core/tests/test_umath.py 2008-10-21 20:13:17 UTC (rev 5954) @@ -47,13 +47,84 @@ class TestMaximum(TestCase): def test_reduce_complex(self): - assert_equal(ncu.maximum.reduce([1,2j]),1) - assert_equal(ncu.maximum.reduce([1+3j,2j]),1+3j) + assert_equal(np.maximum.reduce([1,2j]),1) + assert_equal(np.maximum.reduce([1+3j,2j]),1+3j) + def test_float_nans(self): + nan = np.nan + arg1 = np.array([0, nan, nan]) + arg2 = np.array([nan, 0, nan]) + out = np.array([nan, nan, nan]) + assert_equal(np.maximum(arg1, arg2), out) + + def test_complex_nans(self): + nan = np.nan + for cnan in [nan, nan*1j, nan + nan*1j] : + arg1 = np.array([0, cnan, cnan], dtype=np.complex) + arg2 = np.array([cnan, 0, cnan], dtype=np.complex) + out = np.array([nan, nan, nan], dtype=np.complex) + assert_equal(np.maximum(arg1, arg2), out) + class TestMinimum(TestCase): def test_reduce_complex(self): - assert_equal(ncu.minimum.reduce([1,2j]),2j) + assert_equal(np.minimum.reduce([1,2j]),2j) + assert_equal(np.minimum.reduce([1+3j,2j]),2j) + def test_float_nans(self): + nan = np.nan + arg1 = np.array([0, nan, nan]) + arg2 = np.array([nan, 0, nan]) + out = np.array([nan, nan, nan]) + assert_equal(np.minimum(arg1, arg2), out) + + def test_complex_nans(self): + nan = np.nan + for cnan in [nan, nan*1j, nan + nan*1j] : + arg1 = np.array([0, cnan, cnan], dtype=np.complex) + arg2 = np.array([cnan, 0, cnan], dtype=np.complex) + out = np.array([nan, nan, nan], dtype=np.complex) + assert_equal(np.minimum(arg1, arg2), out) + +class TestFmax(TestCase): + def test_reduce_complex(self): + assert_equal(np.fmax.reduce([1,2j]),1) + assert_equal(np.fmax.reduce([1+3j,2j]),1+3j) + + def test_float_nans(self): + nan = np.nan + arg1 = np.array([0, nan, nan]) + arg2 = np.array([nan, 0, nan]) + out = np.array([0, 0, nan]) + assert_equal(np.fmax(arg1, arg2), out) + + def test_complex_nans(self): + nan = np.nan + for cnan in [nan, nan*1j, nan + nan*1j] : + arg1 = np.array([0, cnan, cnan], dtype=np.complex) + arg2 = np.array([cnan, 0, cnan], dtype=np.complex) + out = np.array([0, 0, nan], dtype=np.complex) + assert_equal(np.fmax(arg1, arg2), out) + +class TestFmin(TestCase): + def test_reduce_complex(self): + assert_equal(np.fmin.reduce([1,2j]),2j) + assert_equal(np.fmin.reduce([1+3j,2j]),2j) + + def test_float_nans(self): + nan = np.nan + arg1 = np.array([0, nan, nan]) + arg2 = np.array([nan, 0, nan]) + out = np.array([0, 0, nan]) + assert_equal(np.fmin(arg1, arg2), out) + + def test_complex_nans(self): + nan = np.nan + for cnan in [nan, nan*1j, nan + nan*1j] : + arg1 = np.array([0, cnan, cnan], dtype=np.complex) + arg2 = np.array([cnan, 0, cnan], dtype=np.complex) + out = np.array([0, 0, nan], dtype=np.complex) + assert_equal(np.fmin(arg1, arg2), out) + class TestFloatingPoint(TestCase): def test_floating_point(self): assert_equal(ncu.FLOATING_POINT_SUPPORT, 1) From numpy-svn at scipy.org Wed Oct 22 01:45:45 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 22 Oct 2008 00:45:45 -0500 (CDT) Subject: [Numpy-svn] r5955 - in branches/ufunc_cleanup/numpy/core: src tests Message-ID: <20081022054545.D094239C0EA@scipy.org> Author: charris Date: 2008-10-22 00:45:42 -0500 (Wed, 22 Oct 2008) New Revision: 5955 Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src branches/ufunc_cleanup/numpy/core/tests/test_umath.py Log: Merge up to current trunk. Modified: branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src =================================================================== --- branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-21 20:13:17 UTC (rev 5954) +++ branches/ufunc_cleanup/numpy/core/src/umathmodule.c.src 2008-10-22 05:45:42 UTC (rev 5955) @@ -1440,18 +1440,14 @@ const @type@ in1i = ((@type@ *)ip1)[1]; const @type@ in2r = ((@type@ *)ip2)[0]; const @type@ in2i = ((@type@ *)ip2)[1]; - if (@OP1@(in1r, in1i, in2r, in2i)) { + if (@OP1@(in1r, in1i, in2r, in2i) || isnan(in1r) || isnan(in1i)) { ((@type@ *)op)[0] = in1r; ((@type@ *)op)[1] = in1i; } - else if (@OP2@(in1r, in1i, in2r, in2i)) { + else { ((@type@ *)op)[0] = in2r; ((@type@ *)op)[1] = in2i; } - else { - ((@type@ *)op)[0] = NAN; - ((@type@ *)op)[1] = NAN; - } } } /**end repeat1**/ @@ -1469,14 +1465,8 @@ const @type@ in2r = ((@type@ *)ip2)[0]; const @type@ in2i = ((@type@ *)ip2)[1]; if (@OP1@(in1r, in1i, in2r, in2i) || isnan(in2r) || isnan(in2i)) { - if (isnan(in1r) || isnan(in1i)) { - ((@type@ *)op)[0] = NAN; - ((@type@ *)op)[1] = NAN; - } - else { - ((@type@ *)op)[0] = in1r; - ((@type@ *)op)[1] = in1i; - } + ((@type@ *)op)[0] = in1r; + ((@type@ *)op)[1] = in1i; } else { ((@type@ *)op)[0] = in2r; @@ -1515,6 +1505,7 @@ } /**end repeat**/ +static void OBJECT_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) { PyObject *zero = PyInt_FromLong(0); Modified: branches/ufunc_cleanup/numpy/core/tests/test_umath.py =================================================================== --- branches/ufunc_cleanup/numpy/core/tests/test_umath.py 2008-10-21 20:13:17 UTC (rev 5954) +++ branches/ufunc_cleanup/numpy/core/tests/test_umath.py 2008-10-22 05:45:42 UTC (rev 5955) @@ -47,13 +47,84 @@ class TestMaximum(TestCase): def test_reduce_complex(self): - assert_equal(ncu.maximum.reduce([1,2j]),1) - assert_equal(ncu.maximum.reduce([1+3j,2j]),1+3j) + assert_equal(np.maximum.reduce([1,2j]),1) + assert_equal(np.maximum.reduce([1+3j,2j]),1+3j) + def test_float_nans(self): + nan = np.nan + arg1 = np.array([0, nan, nan]) + arg2 = np.array([nan, 0, nan]) + out = np.array([nan, nan, nan]) + assert_equal(np.maximum(arg1, arg2), out) + + def test_complex_nans(self): + nan = np.nan + for cnan in [nan, nan*1j, nan + nan*1j] : + arg1 = np.array([0, cnan, cnan], dtype=np.complex) + arg2 = np.array([cnan, 0, cnan], dtype=np.complex) + out = np.array([nan, nan, nan], dtype=np.complex) + assert_equal(np.maximum(arg1, arg2), out) + class TestMinimum(TestCase): def test_reduce_complex(self): - assert_equal(ncu.minimum.reduce([1,2j]),2j) + assert_equal(np.minimum.reduce([1,2j]),2j) + assert_equal(np.minimum.reduce([1+3j,2j]),2j) + def test_float_nans(self): + nan = np.nan + arg1 = np.array([0, nan, nan]) + arg2 = np.array([nan, 0, nan]) + out = np.array([nan, nan, nan]) + assert_equal(np.minimum(arg1, arg2), out) + + def test_complex_nans(self): + nan = np.nan + for cnan in [nan, nan*1j, nan + nan*1j] : + arg1 = np.array([0, cnan, cnan], dtype=np.complex) + arg2 = np.array([cnan, 0, cnan], dtype=np.complex) + out = np.array([nan, nan, nan], dtype=np.complex) + assert_equal(np.minimum(arg1, arg2), out) + +class TestFmax(TestCase): + def test_reduce_complex(self): + assert_equal(np.fmax.reduce([1,2j]),1) + assert_equal(np.fmax.reduce([1+3j,2j]),1+3j) + + def test_float_nans(self): + nan = np.nan + arg1 = np.array([0, nan, nan]) + arg2 = np.array([nan, 0, nan]) + out = np.array([0, 0, nan]) + assert_equal(np.fmax(arg1, arg2), out) + + def test_complex_nans(self): + nan = np.nan + for cnan in [nan, nan*1j, nan + nan*1j] : + arg1 = np.array([0, cnan, cnan], dtype=np.complex) + arg2 = np.array([cnan, 0, cnan], dtype=np.complex) + out = np.array([0, 0, nan], dtype=np.complex) + assert_equal(np.fmax(arg1, arg2), out) + +class TestFmin(TestCase): + def test_reduce_complex(self): + assert_equal(np.fmin.reduce([1,2j]),2j) + assert_equal(np.fmin.reduce([1+3j,2j]),2j) + + def test_float_nans(self): + nan = np.nan + arg1 = np.array([0, nan, nan]) + arg2 = np.array([nan, 0, nan]) + out = np.array([0, 0, nan]) + assert_equal(np.fmin(arg1, arg2), out) + + def test_complex_nans(self): + nan = np.nan + for cnan in [nan, nan*1j, nan + nan*1j] : + arg1 = np.array([0, cnan, cnan], dtype=np.complex) + arg2 = np.array([cnan, 0, cnan], dtype=np.complex) + out = np.array([0, 0, nan], dtype=np.complex) + assert_equal(np.fmin(arg1, arg2), out) + class TestFloatingPoint(TestCase): def test_floating_point(self): assert_equal(ncu.FLOATING_POINT_SUPPORT, 1) From numpy-svn at scipy.org Sun Oct 26 04:51:30 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 26 Oct 2008 03:51:30 -0500 (CDT) Subject: [Numpy-svn] r5956 - branches/1.2.x/numpy/distutils/command Message-ID: <20081026085130.0E7F839C05F@scipy.org> Author: jarrod.millman Date: 2008-10-26 03:51:27 -0500 (Sun, 26 Oct 2008) New Revision: 5956 Modified: branches/1.2.x/numpy/distutils/command/install.py Log: back ported Robert Kern's fix for setuptools (see r5833) Modified: branches/1.2.x/numpy/distutils/command/install.py =================================================================== --- branches/1.2.x/numpy/distutils/command/install.py 2008-10-22 05:45:42 UTC (rev 5955) +++ branches/1.2.x/numpy/distutils/command/install.py 2008-10-26 08:51:27 UTC (rev 5956) @@ -1,8 +1,10 @@ import sys if 'setuptools' in sys.modules: import setuptools.command.install as old_install_mod + have_setuptools = True else: import distutils.command.install as old_install_mod + have_setuptools = False old_install = old_install_mod.install from distutils.file_util import write_file @@ -12,8 +14,41 @@ old_install.finalize_options(self) self.install_lib = self.install_libbase + def setuptools_run(self): + """ The setuptools version of the .run() method. + + We must pull in the entire code so we can override the level used in the + _getframe() call since we wrap this call by one more level. + """ + # Explicit request for old-style install? Just do it + if self.old_and_unmanageable or self.single_version_externally_managed: + return old_install_mod._install.run(self) + + # Attempt to detect whether we were called from setup() or by another + # command. If we were called by setup(), our caller will be the + # 'run_command' method in 'distutils.dist', and *its* caller will be + # the 'run_commands' method. If we were called any other way, our + # immediate caller *might* be 'run_command', but it won't have been + # called by 'run_commands'. This is slightly kludgy, but seems to + # work. + # + caller = sys._getframe(3) + caller_module = caller.f_globals.get('__name__','') + caller_name = caller.f_code.co_name + + if caller_module != 'distutils.dist' or caller_name!='run_commands': + # We weren't called from the command line or setup(), so we + # should run in backward-compatibility mode to support bdist_* + # commands. + old_install_mod._install.run(self) + else: + self.do_egg_install() + def run(self): - r = old_install.run(self) + if not have_setuptools: + r = old_install.run(self) + else: + r = self.setuptools_run() if self.record: # bdist_rpm fails when INSTALLED_FILES contains # paths with spaces. Such paths must be enclosed From numpy-svn at scipy.org Sun Oct 26 13:49:55 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 26 Oct 2008 12:49:55 -0500 (CDT) Subject: [Numpy-svn] r5957 - / Message-ID: <20081026174955.8641D39C226@scipy.org> Author: ptvirtan Date: 2008-10-26 12:49:44 -0500 (Sun, 26 Oct 2008) New Revision: 5957 Added: numpy-docs/ Log: Add location for Numpy documentation From numpy-svn at scipy.org Sun Oct 26 13:50:48 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 26 Oct 2008 12:50:48 -0500 (CDT) Subject: [Numpy-svn] r5958 - numpy-docs Message-ID: <20081026175048.4A03139C226@scipy.org> Author: ptvirtan Date: 2008-10-26 12:50:36 -0500 (Sun, 26 Oct 2008) New Revision: 5958 Added: numpy-docs/branches/ numpy-docs/tags/ numpy-docs/trunk/ Log: Add location for Numpy documentation From numpy-svn at scipy.org Sun Oct 26 13:59:38 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 26 Oct 2008 12:59:38 -0500 (CDT) Subject: [Numpy-svn] r5959 - in numpy-docs/trunk: . source source/_static source/_templates source/reference source/reference/figures source/user Message-ID: <20081026175938.0F6E139C05F@scipy.org> Author: ptvirtan Date: 2008-10-26 12:57:55 -0500 (Sun, 26 Oct 2008) New Revision: 5959 Added: numpy-docs/trunk/Makefile numpy-docs/trunk/README.txt numpy-docs/trunk/postprocess.py numpy-docs/trunk/source/ numpy-docs/trunk/source/_static/ numpy-docs/trunk/source/_static/scipy.css numpy-docs/trunk/source/_templates/ numpy-docs/trunk/source/_templates/indexcontent.html numpy-docs/trunk/source/_templates/indexsidebar.html numpy-docs/trunk/source/_templates/layout.html numpy-docs/trunk/source/about.rst numpy-docs/trunk/source/bugs.rst numpy-docs/trunk/source/conf.py numpy-docs/trunk/source/contents.rst numpy-docs/trunk/source/glossary.rst numpy-docs/trunk/source/license.rst numpy-docs/trunk/source/reference/ numpy-docs/trunk/source/reference/arrays.classes.rst numpy-docs/trunk/source/reference/arrays.dtypes.rst numpy-docs/trunk/source/reference/arrays.indexing.rst numpy-docs/trunk/source/reference/arrays.interface.rst numpy-docs/trunk/source/reference/arrays.ndarray.rst numpy-docs/trunk/source/reference/arrays.rst numpy-docs/trunk/source/reference/arrays.scalars.rst numpy-docs/trunk/source/reference/c-api.array.rst numpy-docs/trunk/source/reference/c-api.config.rst numpy-docs/trunk/source/reference/c-api.dtype.rst numpy-docs/trunk/source/reference/c-api.rst numpy-docs/trunk/source/reference/c-api.types-and-structures.rst numpy-docs/trunk/source/reference/c-api.ufunc.rst numpy-docs/trunk/source/reference/distutils.rst numpy-docs/trunk/source/reference/figures/ numpy-docs/trunk/source/reference/figures/dtype-hierarchy.dia numpy-docs/trunk/source/reference/figures/dtype-hierarchy.pdf numpy-docs/trunk/source/reference/figures/dtype-hierarchy.png numpy-docs/trunk/source/reference/figures/threefundamental.fig numpy-docs/trunk/source/reference/figures/threefundamental.pdf numpy-docs/trunk/source/reference/figures/threefundamental.png numpy-docs/trunk/source/reference/index.rst numpy-docs/trunk/source/reference/internals.code-explanations.rst numpy-docs/trunk/source/reference/internals.rst numpy-docs/trunk/source/reference/routines.array-creation.rst numpy-docs/trunk/source/reference/routines.array-manipulation.rst numpy-docs/trunk/source/reference/routines.bitwise.rst numpy-docs/trunk/source/reference/routines.ctypeslib.rst numpy-docs/trunk/source/reference/routines.dtype.rst numpy-docs/trunk/source/reference/routines.dual.rst numpy-docs/trunk/source/reference/routines.emath.rst numpy-docs/trunk/source/reference/routines.err.rst numpy-docs/trunk/source/reference/routines.fft.rst numpy-docs/trunk/source/reference/routines.financial.rst numpy-docs/trunk/source/reference/routines.functional.rst numpy-docs/trunk/source/reference/routines.help.rst numpy-docs/trunk/source/reference/routines.indexing.rst numpy-docs/trunk/source/reference/routines.io.rst numpy-docs/trunk/source/reference/routines.linalg.rst numpy-docs/trunk/source/reference/routines.logic.rst numpy-docs/trunk/source/reference/routines.ma.rst numpy-docs/trunk/source/reference/routines.math.rst numpy-docs/trunk/source/reference/routines.matlib.rst numpy-docs/trunk/source/reference/routines.numarray.rst numpy-docs/trunk/source/reference/routines.oldnumeric.rst numpy-docs/trunk/source/reference/routines.other.rst numpy-docs/trunk/source/reference/routines.poly.rst numpy-docs/trunk/source/reference/routines.random.rst numpy-docs/trunk/source/reference/routines.rst numpy-docs/trunk/source/reference/routines.set.rst numpy-docs/trunk/source/reference/routines.sort.rst numpy-docs/trunk/source/reference/routines.statistics.rst numpy-docs/trunk/source/reference/routines.window.rst numpy-docs/trunk/source/reference/ufuncs.rst numpy-docs/trunk/source/scipyshiny_small.png numpy-docs/trunk/source/user/ numpy-docs/trunk/source/user/basics.broadcasting.rst numpy-docs/trunk/source/user/basics.creation.rst numpy-docs/trunk/source/user/basics.indexing.rst numpy-docs/trunk/source/user/basics.rec.rst numpy-docs/trunk/source/user/basics.rst numpy-docs/trunk/source/user/basics.subclassing.rst numpy-docs/trunk/source/user/basics.types.rst numpy-docs/trunk/source/user/c-info.beyond-basics.rst numpy-docs/trunk/source/user/c-info.how-to-extend.rst numpy-docs/trunk/source/user/c-info.python-as-glue.rst numpy-docs/trunk/source/user/c-info.rst numpy-docs/trunk/source/user/howtofind.rst numpy-docs/trunk/source/user/index.rst numpy-docs/trunk/source/user/misc.rst numpy-docs/trunk/source/user/performance.rst numpy-docs/trunk/summarize.py Log: Import initial version of Numpy documentation Added: numpy-docs/trunk/Makefile =================================================================== --- numpy-docs/trunk/Makefile 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/Makefile 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,98 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = LANG=C sphinx-build +PAPER = + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + +.PHONY: help clean html web pickle htmlhelp latex changes linkcheck + +help: + @echo "Please use \`make ' where is one of" + @echo " dist to make a distribution-ready tree" + @echo " html to make standalone HTML files" + @echo " pickle to make pickle files (usable by e.g. sphinx-web)" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " changes to make an overview over all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + +clean: + -rm -rf build/* source/reference/generated + +dist: html + test -d build/latex || make latex + make -C build/latex all-pdf + -rm -rf build/dist + cp -r build/html build/dist + perl -pi -e 's#^\s*(
  • NumPy.*?Manual.*?»
  • )#
  • Numpy and Scipy Documentation »
  • #;' build/dist/*.html build/dist/*/*.html build/dist/*/*/*.html + cd build/html && zip -9r ../dist/numpy-html.zip . + cp build/latex/*.pdf build/dist + cd build/dist && tar czf ../dist.tar.gz * + +generate: build/generate-stamp +build/generate-stamp: $(wildcard source/reference/*.rst) ext + mkdir -p build + ./ext/autosummary_generate.py source/reference/*.rst \ + -p dump.xml -o source/reference/generated + touch build/generate-stamp + +ext: + svn co http://sphinx.googlecode.com/svn/contrib/trunk/numpyext ext + +html: generate + mkdir -p build/html build/doctrees + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html + python postprocess.py html build/html/*.html + @echo + @echo "Build finished. The HTML pages are in build/html." + +pickle: generate + mkdir -p build/pickle build/doctrees + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle + @echo + @echo "Build finished; now you can process the pickle files or run" + @echo " sphinx-web build/pickle" + @echo "to start the sphinx-web server." + +web: pickle + +htmlhelp: generate + mkdir -p build/htmlhelp build/doctrees + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in build/htmlhelp." + +latex: generate + mkdir -p build/latex build/doctrees + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex + python postprocess.py tex build/latex/*.tex + @echo + @echo "Build finished; the LaTeX files are in build/latex." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." + +coverage: build + mkdir -p build/coverage build/doctrees + $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) build/coverage + @echo "Coverage finished; see c.txt and python.txt in build/coverage" + +changes: generate + mkdir -p build/changes build/doctrees + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes + @echo + @echo "The overview file is in build/changes." + +linkcheck: generate + mkdir -p build/linkcheck build/doctrees + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in build/linkcheck/output.txt." Property changes on: numpy-docs/trunk/Makefile ___________________________________________________________________ Name: svn:eol-style + native Added: numpy-docs/trunk/README.txt =================================================================== --- numpy-docs/trunk/README.txt 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/README.txt 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,40 @@ +NumPy Reference Guide +===================== + +Instructions +------------ +1. Optionally download an XML dump of the newest docstrings from the doc wiki + at ``/pydocweb/dump`` and save it as ``dump.xml``. +2. Run ``make html`` or ``make dist`` + +You can also run ``summarize.py`` to see which parts of the Numpy +namespace are documented. + + +TODO +---- + +* Numberless [*] footnotes cause LaTeX errors. + +* ``See also`` sections are still somehow broken even if some work. + The problem is that Sphinx searches like this:: + + 'name' + 'active_module.name' + 'active_module.active_class.name'. + + Whereas, we would like to have this: + + 'name' + 'active_module.name' + 'parent_of_active_module.name' + 'parent_of_parent_of_active_module.name' + ... + 'numpy.name' + + We can get one step upwards by always using 'numpy' as the active module. + It seems difficult to beat Sphinx to do what we want. + Do we need to change our docstring standard slightly, ie. allow only + leaving the 'numpy.' prefix away? + +* Link resolution doesn't work as intended... eg. `doc.ufunc`_ Property changes on: numpy-docs/trunk/README.txt ___________________________________________________________________ Name: svn:eol-style + native Added: numpy-docs/trunk/postprocess.py =================================================================== --- numpy-docs/trunk/postprocess.py 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/postprocess.py 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,59 @@ +#!/usr/bin/env python +""" +%prog MODE FILES... + +Post-processes HTML and Latex files output by Sphinx. +MODE is either 'html' or 'tex'. + +""" +import re, optparse + +def main(): + p = optparse.OptionParser(__doc__) + options, args = p.parse_args() + + if len(args) < 1: + p.error('no mode given') + + mode = args.pop(0) + + if mode not in ('html', 'tex'): + p.error('unknown mode %s' % mode) + + for fn in args: + f = open(fn, 'r') + try: + if mode == 'html': + lines = process_html(fn, f.readlines()) + elif mode == 'tex': + lines = process_tex(f.readlines()) + finally: + f.close() + + f = open(fn, 'w') + f.write("".join(lines)) + f.close() + +def process_html(fn, lines): + return lines + +def process_tex(lines): + """ + Remove unnecessary section titles from the LaTeX file. + + """ + new_lines = [] + for line in lines: + if (line.startswith(r'\section{numpy.') + or line.startswith(r'\subsection{numpy.') + or line.startswith(r'\subsubsection{numpy.') + or line.startswith(r'\paragraph{numpy.') + or line.startswith(r'\subparagraph{numpy.') + ): + pass # skip! + else: + new_lines.append(line) + return new_lines + +if __name__ == "__main__": + main() Property changes on: numpy-docs/trunk/postprocess.py ___________________________________________________________________ Name: svn:executable + Added: numpy-docs/trunk/source/_static/scipy.css =================================================================== --- numpy-docs/trunk/source/_static/scipy.css 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/_static/scipy.css 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,155 @@ + at import "default.css"; + +/** + * Spacing fixes + */ + +div.body p, div.body dd, div.body li { + line-height: 125%; +} + +ul.simple { + margin-top: 0; + margin-bottom: 0; + padding-top: 0; + padding-bottom: 0; +} + +/* spacing around blockquoted fields in parameters/attributes/returns */ +td.field-body > blockquote { + margin-top: 0.1em; + margin-bottom: 0.5em; +} + +/* spacing around example code */ +div.highlight > pre { + padding: 2px 5px 2px 5px; +} + +/* spacing in see also definition lists */ +dl.last > dd { + margin-top: 1px; + margin-bottom: 5px; + margin-left: 30px; +} + +/** + * Hide dummy toctrees + */ + +ul { + padding-top: 0; + padding-bottom: 0; + margin-top: 0; + margin-bottom: 0; +} +ul li { + padding-top: 0; + padding-bottom: 0; + margin-top: 0; + margin-bottom: 0; +} +ul li a.reference { + padding-top: 0; + padding-bottom: 0; + margin-top: 0; + margin-bottom: 0; +} + +/** + * Make high-level subsections easier to distinguish from top-level ones + */ +div.body h3 { + background-color: transparent; +} + +div.body h4 { + border: none; + background-color: transparent; +} + +/** + * Scipy colors + */ + +body { + background-color: rgb(100,135,220); +} + +div.document { + background-color: rgb(230,230,230); +} + +div.sphinxsidebar { + background-color: rgb(230,230,230); +} + +div.related { + background-color: rgb(100,135,220); +} + +div.sphinxsidebar h3 { + color: rgb(0,102,204); +} + +div.sphinxsidebar h3 a { + color: rgb(0,102,204); +} + +div.sphinxsidebar h4 { + color: rgb(0,82,194); +} + +div.sphinxsidebar p { + color: black; +} + +div.sphinxsidebar a { + color: #355f7c; +} + +div.sphinxsidebar ul.want-points { + list-style: disc; +} + +.field-list th { + color: rgb(0,102,204); +} + +/** + * Extra admonitions + */ + +div.tip { + background-color: #ffffe4; + border: 1px solid #ee6; +} + +/* +div.admonition-example { + background-color: #e4ffe4; + border: 1px solid #ccc; +}*/ + + +/** + * Styling for field lists + */ + +table.field-list th { + border-left: 1px solid #aaa !important; + padding-left: 5px; +} + +table.field-list { + border-collapse: separate; + border-spacing: 10px; +} + +/** + * Styling for footnotes + */ + +table.footnote td, table.footnote th { + border: none; +} Added: numpy-docs/trunk/source/_templates/indexcontent.html =================================================================== --- numpy-docs/trunk/source/_templates/indexcontent.html 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/_templates/indexcontent.html 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,55 @@ +{% extends "defindex.html" %} +{% block tables %} +

    Parts of the documentation:

    + + +
    + + +
    + +

    Indices and tables:

    + + +
    + + + + + + +
    + +

    Meta information:

    + + +
    + + + + +
    + +

    Acknowledgements

    +

    + Large parts of this manual originate from Travis E. Oliphant's book + "Guide to Numpy" (which generously entered + Public Domain in August 2008). The reference documentation for many of + the functions are written by numerous contributors and developers of + Numpy, both prior to and during the + Numpy Documentation Marathon. +

    +

    + The Documentation Marathon is still ongoing. Please help us write + better documentation for Numpy by joining it! Instructions on how to + join and what to do can be found + on the scipy.org website. +

    +{% endblock %} Added: numpy-docs/trunk/source/_templates/indexsidebar.html =================================================================== --- numpy-docs/trunk/source/_templates/indexsidebar.html 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/_templates/indexsidebar.html 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,5 @@ +

    Resources

    + Added: numpy-docs/trunk/source/_templates/layout.html =================================================================== --- numpy-docs/trunk/source/_templates/layout.html 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/_templates/layout.html 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,4 @@ +{% extends "!layout.html" %} +{% block rootrellink %} +
  • {{ shorttitle }}{{ reldelim1 }}
  • +{% endblock %} Added: numpy-docs/trunk/source/about.rst =================================================================== --- numpy-docs/trunk/source/about.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/about.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,66 @@ +About NumPy +=========== + +`NumPy `__ is the fundamental package +needed for scientific computing with Python. This package contains: + +- a powerful N-dimensional :ref:`array object ` +- sophisticated :ref:`(broadcasting) functions ` +- basic :ref:`linear algebra functions ` +- basic :ref:`Fourier transforms ` +- sophisticated :ref:`random number capabilities ` +- tools for integrating Fortran code +- tools for integrating C/C++ code + +Besides its obvious scientific uses, *NumPy* can also be used as an +efficient multi-dimensional container of generic data. Arbitrary +data-types can be defined. This allows *NumPy* to seamlessly and +speedily integrate with a wide-variety of databases. + +NumPy is a successor for two earlier scientific Python libraries: +NumPy derives from the old *Numeric* code base and can be used +as a replacement for *Numeric*. It also adds the features introduced +by *Numarray* and can also be used to replace *Numarray*. + +NumPy community +--------------- + +Numpy is a distributed, volunteer open-source project. *You* can help +us make it better; if you believe something should be improved either +in functionality or in documentation, don't hesitate to contact us --- or +even better, contact us and participate in fixing the problem. + +Our main means of communication are: + +- `scipy.org website `__ + +- `Mailing lists `__ + +- `Numpy Trac `__ (bug "tickets" go here) + +More information about the development of Numpy can be found at +http://scipy.org/Developer_Zone + +If you want to fix issues in this documentation, the easiest way +is to participate in `our ongoing documentation marathon +`__. + + +About this documentation +======================== + +Conventions +----------- + +Names of classes, objects, constants, etc. are given in **boldface** font. +Often they are also links to a more detailed documentation of the +referred object. + +This manual contains many examples of use, usually prefixed with the +Python prompt ``>>>`` (which is not a part of the example code). The +examples assume that you have first entered:: + +>>> import numpy as np + +before running the examples. + Added: numpy-docs/trunk/source/bugs.rst =================================================================== --- numpy-docs/trunk/source/bugs.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/bugs.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,23 @@ +************** +Reporting bugs +************** + +File bug reports or feature requests, and make contributions +(e.g. code patches), by submitting a "ticket" on the Trac pages: + +- Numpy Trac: http://scipy.org/scipy/numpy + +Because of spam abuse, you must create an account on our Trac in order +to submit a ticket, then click on the "New Ticket" tab that only +appears when you have logged in. Please give as much information as +you can in the ticket. It is extremely useful if you can supply a +small self-contained code snippet that reproduces the problem. Also +specify the component, the version you are referring to and the +milestone. + +Report bugs to the appropriate Trac instance (there is one for NumPy +and a different one for SciPy). There are also read-only mailing lists +for tracking the status of your bug ticket. + +More information can be found on the http://scipy.org/Developer_Zone +website. Added: numpy-docs/trunk/source/conf.py =================================================================== --- numpy-docs/trunk/source/conf.py 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/conf.py 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,229 @@ +# -*- coding: utf-8 -*- + +import sys, os + +# If your extensions are in another directory, add it here. If the directory +# is relative to the documentation root, use os.path.abspath to make it +# absolute, like shown here. +sys.path.append(os.path.abspath('../ext')) + +# Check Sphinx version +import sphinx +if sphinx.__version__ < "0.5": + raise RuntimeError("Sphinx 0.5.dev or newer required") + + +# ----------------------------------------------------------------------------- +# General configuration +# ----------------------------------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.pngmath', 'numpydoc', + 'phantom_import', 'autosummary', 'sphinx.ext.intersphinx', + 'sphinx.ext.coverage'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +#master_doc = 'index' + +# General substitutions. +project = 'NumPy' +copyright = '2008, The Scipy community' + +# The default replacements for |version| and |release|, also used in various +# other places throughout the built documents. +# +# The short X.Y version. +version = '1.2' +# The full version, including alpha/beta/rc tags. +release = '1.2.dev' + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +#unused_docs = [] + +# The reST default role (used for this markup: `text`) to use for all documents. +default_role = "autolink" + +# List of directories, relative to source directories, that shouldn't be searched +# for source files. +exclude_dirs = [] + +# If true, '()' will be appended to :func: etc. cross-reference text. +add_function_parentheses = False + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + + +# ----------------------------------------------------------------------------- +# HTML output +# ----------------------------------------------------------------------------- + +# The style sheet to use for HTML and HTML Help pages. A file of that name +# must exist either in Sphinx' static/ path, or in one of the custom paths +# given in html_static_path. +html_style = 'scipy.css' + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +html_title = "%s v%s Manual (DRAFT)" % (project, version) + +# The name of an image file (within the static path) to place at the top of +# the sidebar. +html_logo = 'scipyshiny_small.png' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +html_sidebars = { + 'index': 'indexsidebar.html' +} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +html_additional_pages = { + 'index': 'indexcontent.html', +} + +# If false, no module index is generated. +html_use_modindex = True + +# If true, the reST sources are included in the HTML build as _sources/. +#html_copy_source = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".html"). +#html_file_suffix = '.html' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'NumPydoc' + +# Pngmath should try to align formulas properly +pngmath_use_preview = True + + +# ----------------------------------------------------------------------------- +# LaTeX output +# ----------------------------------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, document class [howto/manual]). +_stdauthor = 'Written by the NumPy community' +latex_documents = [ + ('reference/index', 'numpy-ref.tex', 'NumPy Reference', + _stdauthor, 'manual'), + ('user/index', 'numpy-user.tex', 'NumPy User Guide', + _stdauthor, 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# Additional stuff for the LaTeX preamble. +latex_preamble = r''' +\usepackage{amsmath} + +% In the parameters section, place a newline after the Parameters +% header +\usepackage{expdlist} +\let\latexdescription=\description +\def\description{\latexdescription{}{} \breaklabel} + +% Make Examples/etc section headers smaller and more compact +\makeatletter +\titleformat{\paragraph}{\normalsize\py at HeaderFamily}% + {\py at TitleColor}{0em}{\py at TitleColor}{\py at NormalColor} +\titlespacing*{\paragraph}{0pt}{1ex}{0pt} +\makeatother + +% Fix footer/header +\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter.\ #1}}{}} +\renewcommand{\sectionmark}[1]{\markright{\MakeUppercase{\thesection.\ #1}}} +''' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +latex_use_modindex = False + + +# ----------------------------------------------------------------------------- +# Intersphinx configuration +# ----------------------------------------------------------------------------- +intersphinx_mapping = {'http://docs.python.org/dev': None} + + +# ----------------------------------------------------------------------------- +# Numpy extensions +# ----------------------------------------------------------------------------- + +# If we want to do a phantom import from an XML file for all autodocs +phantom_import_file = 'dump.xml' + +# Edit links +#numpydoc_edit_link = '`Edit `__' + +# ----------------------------------------------------------------------------- +# Coverage checker +# ----------------------------------------------------------------------------- +coverage_ignore_modules = r""" + """.split() +coverage_ignore_functions = r""" + test($|_) (some|all)true bitwise_not cumproduct pkgload + generic\. + """.split() +coverage_ignore_classes = r""" + """.split() + +coverage_c_path = [] +coverage_c_regexes = {} +coverage_ignore_c_items = {} + + Added: numpy-docs/trunk/source/contents.rst =================================================================== --- numpy-docs/trunk/source/contents.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/contents.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,12 @@ +##################### +Numpy manual contents +##################### + +.. toctree:: + + user/index + reference/index + about + bugs + license + glossary Added: numpy-docs/trunk/source/glossary.rst =================================================================== --- numpy-docs/trunk/source/glossary.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/glossary.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,14 @@ +******** +Glossary +******** + +.. toctree:: + +.. glossary:: + + .. automodule:: numpy.doc.glossary + +Jargon +------ + +.. automodule:: numpy.doc.jargon Added: numpy-docs/trunk/source/license.rst =================================================================== --- numpy-docs/trunk/source/license.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/license.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,35 @@ +************* +Numpy License +************* + +Copyright (c) 2005, NumPy Developers + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* 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. + +* Neither the name of the NumPy Developers nor the names of any + contributors may 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. Added: numpy-docs/trunk/source/reference/arrays.classes.rst =================================================================== --- numpy-docs/trunk/source/reference/arrays.classes.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/arrays.classes.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,414 @@ +######################### +Standard array subclasses +######################### + +.. currentmodule:: numpy + +The :class:`ndarray` in NumPy is a "new-style" Python +built-in-type. Therefore, it can be inherited from (in Python or in C) +if desired. Therefore, it can form a foundation for many useful +classes. Often whether to sub-class the array object or to simply use +the core array component as an internal part of a new class is a +difficult decision, and can be simply a matter of choice. NumPy has +several tools for simplifying how your new object interacts with other +array objects, and so the choice may not be significant in the +end. One way to simplify the question is by asking yourself if the +object you are interested can be replaced as a single array or does it +really require two or more arrays at its core. + +Note that :func:`asarray` always returns the base-class ndarray. If +you are confident that your use of the array object can handle any +subclass of an ndarray, then :func:`asanyarray` can be used to allow +subclasses to propagate more cleanly through your subroutine. In +principal a subclass could redefine any aspect of the array and +therefore, under strict guidelines, :func:`asanyarray` would rarely be +useful. However, most subclasses of the arrayobject will not +redefine certain aspects of the array object such as the buffer +interface, or the attributes of the array. One of important example, +however, of why your subroutine may not be able to handle an arbitrary +subclass of an array is that matrices redefine the "*" operator to be +matrix-multiplication, rather than element-by-element multiplication. + + +Special attributes and methods +============================== + +.. seealso:: :ref:`Subclassing ndarray ` + +Numpy provides several hooks that subclasses of :class:`ndarray` can +customize: + +.. function:: __array_finalize__(self) + + This method is called whenever the system internally allocates a + new array from *obj*, where *obj* is a subclass (subtype) of the + :class:`ndarray`. It can be used to change attributes of *self* after + construction (so as to ensure a 2-d matrix for example), or to + update meta-information from the "parent." Subclasses inherit a + default implementation of this method that does nothing. + +.. function:: __array_wrap__(array) + + This method should return an instance of the subclass from the + :class:`ndarray` object passed in. For example, this is called + after every :ref:`ufunc ` for the object with + the highest array priority. The ufunc-computed array object is + passed in and whatever is returned is passed to the + user. Subclasses inherit a default implementation of this method. + +.. data:: __array_priority__ + + The value of this attribute is used to determine what type of + object to return in situations where there is more than one + possibility for the Python type of the returned object. Subclasses + inherit a default value of 1.0 for this attribute. + +.. function:: __array__([dtype]) + + If a class having the :obj:`__array__` method is used as the output + object of an :ref:`ufunc `, results will be + written to the object returned by :obj:`__array__`. + +Matrix objects +============== + +.. index:: + single: matrix + +:class:`matrix` objects inherit from the ndarray and therefore, they +have the same attributes and methods of ndarrays. There are six +important differences of matrix objects, however that may lead to +unexpected results when you use matrices but expect them to act like +arrays: + +1. Matrix objects can be created using a string notation to allow Matlab- + style syntax where spaces separate columns and semicolons (';') + separate rows. + +2. Matrix objects are always two-dimensional. This has far-reaching + implications, in that m.ravel() is still two-dimensional (with a 1 in + the first dimension) and item selection returns two-dimensional + objects so that sequence behavior is fundamentally different than + arrays. + +3. Matrix objects over-ride multiplication to be + matrix-multiplication. **Make sure you understand this for + functions that you may want to receive matrices. Especially in + light of the fact that asanyarray(m) returns a matrix when m is a + matrix.** + +4. Matrix objects over-ride power to be matrix raised to a power. The + same warning about using power inside a function that uses + asanyarray(...) to get an array object holds for this fact. + +5. The default __array_priority\__ of matrix objects is 10.0, and + therefore mixed operations with ndarrays always produce matrices. + +6. Matrices have special attributes which make calculations easier. These + are + + .. autosummary:: + :toctree: generated/ + + matrix.T + matrix.H + matrix.I + matrix.A + +.. warning:: + + Matrix objects over-ride multiplication, '*', and power, '**', to be + matrix-multiplication and matrix power, respectively. If your + subroutine can accept sub-classes and you do not convert to base-class + arrays, then you must use the ufuncs multiply and power to be sure + that you are performing the correct operation for all inputs. + +The matrix class is a Python subclass of the ndarray and can be used +as a reference for how to construct your own subclass of the ndarray. +Matrices can be created from other matrices, strings, and anything +else that can be converted to an ``ndarray`` . The name "mat "is an +alias for "matrix "in NumPy. + +.. autosummary:: + :toctree: generated/ + + matrix + asmatrix + bmat + +Example 1: Matrix creation from a string + +>>> a=mat('1 2 3; 4 5 3') +>>> print (a*a.T).I +[[ 0.2924 -0.1345] + [-0.1345 0.0819]] + +Example 2: Matrix creation from nested sequence + +>>> mat([[1,5,10],[1.0,3,4j]]) +matrix([[ 1.+0.j, 5.+0.j, 10.+0.j], + [ 1.+0.j, 3.+0.j, 0.+4.j]]) + +Example 3: Matrix creation from an array + +>>> mat(random.rand(3,3)).T +matrix([[ 0.7699, 0.7922, 0.3294], + [ 0.2792, 0.0101, 0.9219], + [ 0.3398, 0.7571, 0.8197]]) + +Memory-mapped file arrays +========================= + +.. index:: + single: memory maps + +.. currentmodule:: numpy + +Memory-mapped files are useful for reading and/or modifying small +segments of a large file with regular layout, without reading the +entire file into memory. A simple subclass of the ndarray uses a +memory-mapped file for the data buffer of the array. For small files, +the over-head of reading the entire file into memory is typically not +significant, however for large files using memory mapping can save +considerable resources. + +Memory-mapped-file arrays have one additional method (besides those +they inherit from the ndarray): :meth:`.flush() ` which +must be called manually by the user to ensure that any changes to the +array actually get written to disk. + +.. note:: + + Memory-mapped arrays use the the Python memory-map object which (prior + to Python 2.5) does not allow files to be larger than a certain size + depending on the platform. This size is always < 2GB even on 64-bit + systems. + +.. autosummary:: + :toctree: generated/ + + memmap + memmap.flush + +Example: + +>>> a = memmap('newfile.dat', dtype=float, mode='w+', shape=1000) +>>> a[10] = 10.0 +>>> a[30] = 30.0 +>>> del a +>>> b = fromfile('newfile.dat', dtype=float) +>>> print b[10], b[30] +10.0 30.0 +>>> a = memmap('newfile.dat', dtype=float) +>>> print a[10], a[30] +10.0 30.0 + + +Character arrays (:mod:`numpy.char`) +==================================== + +.. seealso:: :ref:`routines.array-creation.char` + +.. index:: + single: character arrays + +These are enhanced arrays of either :class:`string` type or +:class:`unicode_` type. These arrays inherit from the +:class:`ndarray`, but specially-define the operations ``+``, ``*``, +and ``%`` on a (broadcasting) element-by-element basis. These +operations are not available on the standard :class:`ndarray` of +character type. In addition, the :class:`chararray` has all of the +standard :class:`string ` (and :class:`unicode`) methods, +executing them on an element-by-element basis. Perhaps the easiest way +to create a chararray is to use :meth:`self.view(chararray) +` where *self* is an ndarray of string or unicode +data-type. However, a chararray can also be created using the +:meth:`numpy.chararray` constructor, or via the +:func:`numpy.char.array` function: + +.. autosummary:: + :toctree: generated/ + + chararray + core.defchararray.array + +Another difference with the standard ndarray of string data-type is +that the chararray inherits the feature introduced by Numarray that +white-space at the end of any element in the array will be ignored on +item retrieval and comparison operations. + + +.. _arrays.classes.rec: + +Record arrays (:mod:`numpy.rec`) +================================ + +.. seealso:: :ref:`routines.array-creation.rec`, :ref:`routines.dtype`, + :ref:`arrays.dtypes`. + +Numpy provides the :class:`recarray` class which allows accessing the +fields of a record/structured array as attributes, and a corresponding +scalar data type object :class:`record`. + +.. currentmodule:: numpy + +.. autosummary:: + :toctree: generated/ + + recarray + record + +Masked arrays (:mod:`numpy.ma`) +=============================== + +.. seealso:: :ref:`routines.ma` + +.. XXX: masked array documentation should be improved + +.. currentmodule:: numpy + +.. index:: + single: masked arrays + +.. autosummary:: + :toctree: generated/ + + ma.masked_array + +.. automodule:: numpy.ma + + +Standard container class +======================== + +.. currentmodule:: numpy + +For backward compatibility and as a standard "container "class, the +UserArray from Numeric has been brought over to NumPy and named +:class:`numpy.lib.user_array.container` The container class is a +Python class whose self.array attribute is an ndarray. Multiple +inheritance is probably easier with numpy.lib.user_array.container +than with the ndarray itself and so it is included by default. It is +not documented here beyond mentioning its existence because you are +encouraged to use the ndarray class directly if you can. + +.. autosummary:: + :toctree: generated/ + + numpy.lib.user_array.container + +.. index:: + single: user_array + single: container class + + +Array Iterators +=============== + +.. currentmodule:: numpy + +.. index:: + single: array iterator + +Iterators are a powerful concept for array processing. Essentially, +iterators implement a generalized for-loop. If *myiter* is an iterator +object, then the Python code:: + + for val in myiter: + ... + some code involving val + ... + +calls ``val = myiter.next()`` repeatedly until :exc:`StopIteration` is +raised by the iterator. There are several ways to iterate over an +array that may be useful: default iteration, flat iteration, and +:math:`N`-dimensional enumeration. + + +Default iteration +----------------- + +The default iterator of an ndarray object is the default Python +iterator of a sequence type. Thus, when the array object itself is +used as an iterator. The default behavior is equivalent to:: + + for i in arr.shape[0]: + val = arr[i] + +This default iterator selects a sub-array of dimension :math:`N-1` from the array. This can be a useful construct for defining recursive +algorithms. To loop over the entire array requires :math:`N` for-loops. + +>>> a = arange(24).reshape(3,2,4)+10 +>>> for val in a: +... print 'item:', val +item: [[10 11 12 13] + [14 15 16 17]] +item: [[18 19 20 21] + [22 23 24 25]] +item: [[26 27 28 29] + [30 31 32 33]] + + +Flat iteration +-------------- + +.. autosummary:: + :toctree: generated/ + + ndarray.flat + +As mentioned previously, the flat attribute of ndarray objects returns +an iterator that will cycle over the entire array in C-style +contiguous order. + +>>> for i, val in enumerate(a.flat): +... if i%5 == 0: print i, val +0 10 +5 15 +10 20 +15 25 +20 30 + +Here, I've used the built-in enumerate iterator to return the iterator +index as well as the value. + + +N-dimensional enumeration +------------------------- + +.. autosummary:: + :toctree: generated/ + + ndenumerate + +Sometimes it may be useful to get the N-dimensional index while +iterating. The ndenumerate iterator can achieve this. + +>>> for i, val in ndenumerate(a): +... if sum(i)%5 == 0: print i, val +(0, 0, 0) 10 +(1, 1, 3) 25 +(2, 0, 3) 29 +(2, 1, 2) 32 + + +Iterator for broadcasting +------------------------- + +.. autosummary:: + :toctree: generated/ + + broadcast + +The general concept of broadcasting is also available from Python +using the :class:`broadcast` iterator. This object takes :math:`N` +objects as inputs and returns an iterator that returns tuples +providing each of the input sequence elements in the broadcasted +result. + +>>> for val in broadcast([[1,0],[2,3]],[0,1]): +... print val +(1, 0) +(0, 1) +(2, 0) +(3, 1) Added: numpy-docs/trunk/source/reference/arrays.dtypes.rst =================================================================== --- numpy-docs/trunk/source/reference/arrays.dtypes.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/arrays.dtypes.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,513 @@ +.. currentmodule:: numpy + +.. _arrays.dtypes: + +********************************** +Data type objects (:class:`dtype`) +********************************** + +A data type object (an instance of :class:`numpy.dtype` class) +describes how the bytes in the fixed-size block of memory +corresponding to an array item should be interpreted. It describes the +following aspects of the data: + +1. Type of the data (integer, float, Python object, etc.) +2. Size of the data (how many bytes is in *e.g.* the integer) +3. Byte order of the data (:term:`little-endian` or :term:`big-endian`) +4. If the data type is a :term:`record`, an aggregate of other + data types, (*e.g.*, describing an array item consisting of + an integer and a float), + + 1. what are the names of the ":term:`fields `" of the record, + by which they can be :ref:`accessed `, + 2. what is the data-type of each :term:`field`, and + 3. which part of the memory block each field takes. + +5. If the data is a sub-array, what is its shape and data type. + +.. index:: + pair: dtype; scalar + +To describe the type of scalar data, there are several :ref:`built-in +scalar types ` in Numpy for various precision +of integers, floating-point numbers, *etc*. An item extracted from an +array, *e.g.*, by indexing, will be a Python object whose type is the +scalar type associated with the data type of the array. + +Note that the scalar types are not :class:`dtype` objects, even though +they can be used in place of one whenever a data type specification is +needed in Numpy. + +.. index:: + pair: dtype; field + pair: dtype; record + +Record data types are formed by creating a data type whose +:term:`fields` contain other data types. Each field has a name by +which it can be :ref:`accessed `. The parent data +type should be of sufficient size to contain all its fields; the +parent can for example be based on the :class:`void` type which allows +an arbitrary item size. Record data types may also contain other record +types and fixed-size sub-array data types in their fields. + +.. index:: + pair: dtype; sub-array + +Finally, a data type can describe items that are themselves arrays of +items of another data type. These sub-arrays must, however, be of a +fixed size. If an array is created using a data-type describing a +sub-array, the dimensions of the sub-array are appended to the shape +of the array when the array is created. Sub-arrays in a field of a +record behave differently, see :ref:`arrays.indexing.rec`. + +.. admonition:: Example + + A simple data type containing a 32-bit big-endian integer: + (see :ref:`arrays.dtypes.constructing` for details on construction) + + >>> dt = np.dtype('>i4') + >>> dt.byteorder + '>' + >>> dt.itemsize + 4 + >>> dt.name + 'int32' + >>> dt.type is np.int32 + True + + The corresponding array scalar type is :class:`int32`. + +.. admonition:: Example + + A record data type containing a 16-character string (in field 'name') + and a sub-array of two 64-bit floating-point number (in field 'grades'): + + >>> dt = np.dtype([('name', np.str_, 16), ('grades', np.float64, (2,))]) + >>> dt['name'] + dtype('|S16') + >>> dt['grades'] + dtype(('float64',(2,))) + + Items of an array of this data type are wrapped in an :ref:`array + scalar ` type that also has two fields: + + >>> x = np.array([('Sarah', (8.0, 7.0)), ('John', (6.0, 7.0))], dtype=dt) + >>> x[1] + ('John', [6.0, 7.0]) + >>> x[1]['grades'] + array([ 6., 7.]) + >>> type(x[1]) + + >>> type(x[1]['grades']) + + +.. _arrays.dtypes.constructing: + +Specifying and constructing data types +====================================== + +Whenever a data-type is required in a NumPy function or method, either +a :class:`dtype` object or something that can be converted to one can +be supplied. Such conversions are done by the :class:`dtype` +constructor: + +.. autosummary:: + :toctree: generated/ + + dtype + +What can be converted to a data-type object is described below: + +:class:`dtype` object + + .. index:: + triple: dtype; construction; from dtype + + Used as-is. + +:const:`None` + + .. index:: + triple: dtype; construction; from None + + The default data type: :class:`float_`. + +.. index:: + triple: dtype; construction; from type + +Array-scalar types + + The 21 built-in :ref:`array scalar type objects + ` all convert to an associated data-type object. + This is true for their sub-classes as well. + + Note that not all data-type information can be supplied with a + type-object: for example, :term:`flexible` data-types have + a default *itemsize* of 0, and require an explicitly given size + to be useful. + + .. admonition:: Example + + >>> dt = np.dtype(np.int32) # 32-bit integer + >>> dt = np.dtype(np.complex128) # 128-bit complex floating-point number + +Generic types + + The generic hierarchical type objects convert to corresponding + type objects according to the associations: + + ===================================================== =============== + :class:`number`, :class:`inexact`, :class:`floating` :class:`float` + :class:`complexfloating` :class:`cfloat` + :class:`integer`, :class:`signedinteger` :class:`int\_` + :class:`unsignedinteger` :class:`uint` + :class:`character` :class:`string` + :class:`generic`, :class:`flexible` :class:`void` + ===================================================== =============== + +Built-in Python types + + Several python types are equivalent to a corresponding + array scalar when used to generate a :class:`dtype` object: + + ================ =============== + :class:`int` :class:`int\_` + :class:`bool` :class:`bool\_` + :class:`float` :class:`float\_` + :class:`complex` :class:`cfloat` + :class:`str` :class:`string` + :class:`unicode` :class:`unicode\_` + :class:`buffer` :class:`void` + (all others) :class:`object_` + ================ =============== + + .. admonition:: Example + + >>> dt = np.dtype(float) # Python-compatible floating-point number + >>> dt = np.dtype(int) # Python-compatible integer + >>> dt = np.dtype(object) # Python object + +Types with ``.dtype`` + + Any type object with a ``dtype`` attribute: The attribute will be + accessed and used directly. The attribute must return something + that is convertible into a dtype object. + +.. index:: + triple: dtype; construction; from string + +Several kinds of strings can be converted. Recognized strings can be +prepended with ``'>'`` (:term:`big-endian`), ``'<'`` +(:term:`little-endian`), or ``'='`` (hardware-native, the default), to +specify the byte order. + +One-character strings + + Each built-in data-type has a character code + (the updated Numeric typecodes), that uniquely identifies it. + + .. admonition:: Example + + >>> dt = np.dtype('b') # byte, native byte order + >>> dt = np.dtype('>H') # big-endian unsigned short + >>> dt = np.dtype('>> dt = np.dtype('d') # double-precision floating-point number + +Array-protocol type strings (see :ref:`arrays.interface`) + + The first character specifies the kind of data and the remaining + characters specify how many bytes of data. The supported kinds are + + ================ ======================== + ``'b'`` Boolean + ``'i'`` (signed) integer + ``'u'`` unsigned integer + ``'f'`` floating-point + ``'c'`` complex-floating point + ``'S'``, ``'a'`` string + ``'U'`` unicode + ``'V'`` anything (:class:`void`) + ================ ======================== + + .. admonition:: Example + + >>> dt = np.dtype('i4') # 32-bit signed integer + >>> dt = np.dtype('f8') # 64-bit floating-point number + >>> dt = np.dtype('c16') # 128-bit complex floating-point number + >>> dt = np.dtype('a25') # 25-character string + +String with comma-separated fields + + Numarray introduced a short-hand notation for specifying the format + of a record as a comma-separated string of basic formats. + + A basic format in this context is an optional shape specifier + followed by an array-protocol type string. Parenthesis are required + on the shape if it is greater than 1-d. NumPy allows a modification + on the format in that any string that can uniquely identify the + type can be used to specify the data-type in a field. + The generated data-type fields are named ``'f0'``, ``'f2'``, ..., + ``'f'`` where N (>1) is the number of comma-separated basic + formats in the string. If the optional shape specifier is provided, + then the data-type for the corresponding field describes a sub-array. + + .. admonition:: Example + + - field named ``f0`` containing a 32-bit integer + - field named ``f1`` containing a 2 x 3 sub-array + of 64-bit floating-point numbers + - field named ``f2`` containing a 32-bit floating-point number + + >>> dt = np.dtype("i4, (2,3)f8, f4") + + - field named ``f0`` containing a 3-character string + - field named ``f1`` containing a sub-array of shape (3,) + containing 64-bit unsigned integers + - field named ``f2`` containing a 3 x 4 sub-array + containing 10-character strings + + >>> dt = np.dtype("a3, 3u8, (3,4)a10") + +Type strings + + Any string in :obj:`numpy.sctypeDict`.keys(): + + .. admonition:: Example + + >>> dt = np.dtype('uint32') # 32-bit unsigned integer + >>> dt = np.dtype('Float64') # 64-bit floating-point number + +.. index:: + triple: dtype; construction; from tuple + +``(flexible_dtype, itemsize)`` + + The first argument must be an object that is converted to a + flexible data-type object (one whose element size is 0), the + second argument is an integer providing the desired itemsize. + + .. admonition:: Example + + >>> dt = np.dtype((void, 10)) # 10-byte wide data block + >>> dt = np.dtype((str, 35)) # 35-character string + >>> dt = np.dtype(('U', 10)) # 10-character unicode string + +``(fixed_dtype, shape)`` + + .. index:: + pair: dtype; sub-array + + The first argument is any object that can be converted into a + fixed-size data-type object. The second argument is the desired + shape of this type. If the shape parameter is 1, then the + data-type object is equivalent to fixed dtype. If *shape* is a + tuple, then the new dtype defines a sub-array of the given shape. + + .. admonition:: Example + + >>> dt = np.dtype((np.int32, (2,2))) # 2 x 2 integer sub-array + >>> dt = np.dtype(('S10', 1)) # 10-character string + >>> dt = np.dtype(('i4, (2,3)f8, f4', (2,3))) # 2 x 3 record sub-array + +``(base_dtype, new_dtype)`` + + Both arguments must be convertible to data-type objects in this + case. The *base_dtype* is the data-type object that the new + data-type builds on. This is how you could assign named fields to + any built-in data-type object. + + .. admonition:: Example + + 32-bit integer, whose first two bytes are interpreted as an integer + via field ``real``, and the following two bytes via field ``imag``. + + >>> dt = np.dtype((np.int32, {'real': (np.int16, 0), 'imag': (np.int16, 2)}) + + 32-bit integer, which is interpreted as consisting of a sub-array + of shape ``(4,)`` containing 8-bit integers: + + >>> dt = np.dtype((np.int32, (np.int8, 4))) + + 32-bit integer, containing fields ``r``, ``g``, ``b``, ``a`` that + interpret the 4 bytes in the integer as four unsigned integers: + + >>> dt = np.dtype(('i4', [('r','u1'),('g','u1'),('b','u1'),('a','u1')])) + +.. note:: XXX: does the second-to-last example above make sense? + +.. index:: + triple: dtype; construction; from list + +``[(field_name, field_dtype, field_shape), ...]`` + + *obj* should be a list of fields where each field is described by a + tuple of length 2 or 3. (Equivalent to the ``descr`` item in the + :obj:`__array_interface__` attribute.) + + The first element, *field_name*, is the field name (if this is + ``''`` then a standard field name, ``'f#'``, is assigned). The + field name may also be a 2-tuple of strings where the first string + is either a "title" (which may be any string or unicode string) or + meta-data for the field which can be any object, and the second + string is the "name" which must be a valid Python identifier. + + The second element, *field_dtype*, can be anything that can be + interpreted as a data-type. + + The optional third element *field_shape* contains the shape if this + field represents an array of the data-type in the second + element. Note that a 3-tuple with a third argument equal to 1 is + equivalent to a 2-tuple. + + This style does not accept *align* in the :class:`dtype` + constructor as it is assumed that all of the memory is accounted + for by the array interface description. + + .. admonition:: Example + + Data-type with fields ``big`` (big-endian 32-bit integer) and + ``little`` (little-endian 32-bit integer): + + >>> dt = np.dtype([('big', '>i4'), ('little', '>> dt = np.dtype([('R','u1'), ('G','u1'), ('B','u1'), ('A','u1')]) + +.. index:: + triple: dtype; construction; from dict + +``{'names': ..., 'formats': ..., 'offsets': ..., 'titles': ...}`` + + This style has two required and two optional keys. The *names* + and *formats* keys are required. Their respective values are + equal-length lists with the field names and the field formats. + The field names must be strings and the field formats can be any + object accepted by :class:`dtype` constructor. + + The optional keys in the dictionary are *offsets* and *titles* and + their values must each be lists of the same length as the *names* + and *formats* lists. The *offsets* value is a list of byte offsets + (integers) for each field, while the *titles* value is a list of + titles for each field (:const:`None` can be used if no title is + desired for that field). The *titles* can be any :class:`string` + or :class:`unicode` object and will add another entry to the + fields dictionary keyed by the title and referencing the same + field tuple which will contain the title as an additional tuple + member. + + .. admonition:: Example + + Data type with fields ``r``, ``g``, ``b``, ``a``, each being + a 8-bit unsigned integer: + + >>> dt = np.dtype({'names': ['r','g','b','a'], + ... 'formats': [uint8, uint8, uint8, uint8]}) + + Data type with fields ``r`` and ``b`` (with the given titles), + both being 8-bit unsigned integers, the first at byte position + 0 from the start of the field and the second at position 2: + + >>> dt = np.dtype({'names': ['r','b'], 'formats': ['u1', 'u1'], + ... 'offsets': [0, 2], + ... 'titles': ['Red pixel', 'Blue pixel']}) + + +``{'field1': ..., 'field2': ..., ...}`` + + This style allows passing in the :attr:`fields ` + attribute of a data-type object. + + *obj* should contain string or unicode keys that refer to + ``(data-type, offset)`` or ``(data-type, offset, title)`` tuples. + + .. admonition:: Example + + Data type containing field ``col1`` (10-character string at + byte position 0), ``col2`` (32-bit float at byte position 10), + and ``col3`` (integers at byte position 14): + + >>> dt = np.dtype({'col1': ('S10', 0), 'col2': (float32, 10), 'col3': (int, 14)}) + + +:class:`dtype` +============== + +Numpy data type descriptions are instances of the :class:`dtype` class. + +Attributes +---------- + +The type of the data is described by the following :class:`dtype` attributes: + +.. autosummary:: + :toctree: generated/ + + dtype.type + dtype.kind + dtype.char + dtype.num + dtype.str + +Size of the data is in turn described by: + +.. autosummary:: + :toctree: generated/ + + dtype.name + dtype.itemsize + +Endianness of this data: + +.. autosummary:: + :toctree: generated/ + + dtype.byteorder + +Information about sub-data-types in a :term:`record`: + +.. autosummary:: + :toctree: generated/ + + dtype.fields + dtype.names + +For data types that describe sub-arrays: + +.. autosummary:: + :toctree: generated/ + + dtype.subdtype + dtype.shape + +Attributes providing additional information: + +.. autosummary:: + :toctree: generated/ + + dtype.hasobject + dtype.flags + dtype.isbuiltin + dtype.isnative + dtype.descr + dtype.alignment + + +Methods +------- + +Data types have the following method for changing the byte order: + +.. autosummary:: + :toctree: generated/ + + dtype.newbyteorder + +The following methods implement the pickle protocol: + +.. autosummary:: + :toctree: generated/ + + dtype.__reduce__ + dtype.__setstate__ Added: numpy-docs/trunk/source/reference/arrays.indexing.rst =================================================================== --- numpy-docs/trunk/source/reference/arrays.indexing.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/arrays.indexing.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,375 @@ +.. _arrays.indexing: + +Indexing +======== + +.. sectionauthor:: adapted from "Guide to Numpy" by Travis E. Oliphant + +.. currentmodule:: numpy + +.. index:: indexing, slicing + +:class:`ndarrays ` can be indexed using the standard Python +``x[obj]`` syntax, where *x* is the array and *obj* the selection. +There are three kinds of indexing available: record access, basic +slicing, advanced indexing. Which one occurs depends on *obj*. + +.. note:: + + In Python, ``x[(exp1, exp2, ..., expN)]`` is equivalent to + ``x[exp1, exp2, ..., expN]``; the latter is just syntactic sugar + for the former. + + +Basic Slicing +------------- + +Basic slicing extends Python's basic concept of slicing to N +dimensions. Basic slicing occurs when *obj* is a :class:`slice` object +(constructed by ``start:stop:step`` notation inside of brackets), an +integer, or a tuple of slice objects and integers. :const:`Ellipsis` +and :const:`newaxis` objects can be interspersed with these as +well. In order to remain backward compatible with a common usage in +Numeric, basic slicing is also initiated if the selection object is +any sequence (such as a :class:`list`) containing :class:`slice` +objects, the :const:`Ellipsis` object, or the :const:`newaxis` object, +but no integer arrays or other embedded sequences. + +.. index:: + triple: ndarray; special methods; getslice + triple: ndarray; special methods; setslice + single: ellipsis + single: newaxis + +The simplest case of indexing with *N* integers returns an :ref:`array +scalar ` representing the corresponding item. As in +Python, all indices are zero-based: for the *i*-th index :math:`n_i`, +the valid range is :math:`0 \le n_i < d_i` where :math:`d_i` is the +*i*-th element of the shape of the array. Negative indices are +interpreted as counting from the end of the array (*i.e.*, if *i < 0*, +it means :math:`n_i + i`). + + +All arrays generated by basic slicing are always :term:`views ` +of the original array. + +The standard rules of sequence slicing apply to basic slicing on a +per-dimension basis (including using a step index). Some useful +concepts to remember include: + +- The basic slice syntax is ``i:j:k`` where *i* is the starting index, + *j* is the stopping index, and *k* is the step (:math:`k\neq0`). + This selects the *m* elements (in the corresponding dimension) with + index values *i*, *i + k*, ..., *i + (m - 1) k* where + :math:`m = q + (r\neq0)` and *q* and *r* are the quotient and remainder + obtained by dividing *j - i* by *k*: *j - i = q k + r*, so that + *i + (m - 1) k < j*. + + .. admonition:: Example + + >>> x = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) + >>> x[1:7:2] + array([1, 3, 5]) + +- Negative *i* and *j* are interpreted as *n + i* and *n + j* where + *n* is the number of elements in the corresponding dimension. + Negative *k* makes stepping go towards smaller indices. + + .. admonition:: Example + + >>> x[-2:10] + array([8, 9]) + >>> x[-3:3:-1] + array([7, 6, 5, 4]) + +- Assume *n* is the number of elements in the dimension being + sliced. Then, if *i* is not given it defaults to 0 for *k > 0* and + *n* for *k < 0* . If *j* is not given it defaults to *n* for *k > 0* + and -1 for *k < 0* . If *k* is not given it defaults to 1. Note that + ``::`` is the same as ``:`` and means select all indices along this + axis. + + .. admonition:: Example + + >>> x[5:] + array([5, 6, 7, 8, 9]) + +- If the number of objects in the selection tuple is less than + *N* , then ``:`` is assumed for any subsequent dimensions. + + .. admonition:: Example + + >>> x = np.array([[[1],[2],[3]], [[4],[5],[6]]]) + >>> x.shape + (2, 3, 1) + >>> x[1:2] + array([[[4], + [5], + [6]]]) + +- :const:`Ellipsis` expand to the number of ``:`` objects needed to + make a selection tuple of the same length as ``x.ndim``. Only the + first ellipsis is expanded, any others are interpreted as ``:``. + + .. admonition:: Example + + >>> x[...,0] + array([[1, 2, 3], + [4, 5, 6]]) + +- Each :const:`newaxis` object in the selection tuple serves to expand + the dimensions of the resulting selection by one unit-length + dimension. The added dimension is the position of the :const:`newaxis` + object in the selection tuple. + + .. admonition:: Example + + >>> x[:,np.newaxis,:,:].shape + (2, 1, 3, 1) + +- An integer, *i*, returns the same values as ``i:i+1`` + **except** the dimensionality of the returned object is reduced by + 1. In particular, a selection tuple with the *p*-th + element an integer (and all other entries ``:``) returns the + corresponding sub-array with dimension *N - 1*. If *N = 1* + then the returned object is an array scalar. These objects are + explained in :ref:`arrays.scalars`. + +- If the selection tuple has all entries ``:`` except the + *p*-th entry which is a slice object ``i:j:k``, + then the returned array has dimension *N* formed by + concatenating the sub-arrays returned by integer indexing of + elements *i*, *i+k*, ..., *i + (m - 1) k < j*, + +- Basic slicing with more than one non-``:`` entry in the slicing + tuple, acts like repeated application of slicing using a single + non-``:`` entry, where the non-``:`` entries are successively taken + (with all other non-``:`` entries replaced by ``:``). Thus, + ``x[ind1,...,ind2,:]`` acts like ``x[ind1][...,ind2,:]`` under basic + slicing. + + .. warning:: The above is **not** true for advanced slicing. + +- You may use slicing to set values in the array, but (unlike lists) you + can never grow the array. The size of the value to be set in + ``x[obj] = value`` must be (broadcastable) to the same shape as + ``x[obj]``. + +.. index:: + pair: ndarray; view + +.. note:: + + Remember that a slicing tuple can always be constructed as *obj* + and used in the ``x[obj]`` notation. Slice objects can be used in + the construction in place of the ``[start:stop:step]`` + notation. For example, ``x[1:10:5,::-1]`` can also be implemented + as ``obj = (slice(1,10,5), slice(None,None,-1)); x[obj]`` . This + can be useful for constructing generic code that works on arrays + of arbitrary dimension. + +.. data:: newaxis + + The :const:`newaxis` object can be used in the basic slicing syntax + discussed above. :const:`None` can also be used instead of + :const:`newaxis`. + + +Advanced indexing +----------------- + +Advanced indexing is triggered when the selection object, *obj*, is a +non-tuple sequence object, an :class:`ndarray` (of data type integer or bool), +or a tuple with at least one sequence object or ndarray (of data type +integer or bool). There are two types of advanced indexing: integer +and Boolean. + +Advanced indexing always returns a *copy* of the data (contrast with +basic slicing that returns a :term:`view`). + +Integer +^^^^^^^ + +Integer indexing allows selection of arbitrary items in the array +based on their *N*-dimensional index. This kind of selection occurs +when advanced indexing is triggered and the selection object is not +an array of data type bool. For the discussion below, when the +selection object is not a tuple, it will be referred to as if it had +been promoted to a 1-tuple, which will be called the selection +tuple. The rules of advanced integer-style indexing are: + +- If the length of the selection tuple is larger than *N* an error is raised. + +- All sequences and scalars in the selection tuple are converted to + :class:`intp` indexing arrays. + +- All selection tuple objects must be convertible to :class:`intp` + arrays, :class:`slice` objects, or the :const:`Ellipsis` object. + +- The first :const:`Ellipsis` object will be expanded, and any other + :const:`Ellipsis` objects will be treated as full slice (``:``) + objects. The expanded :const:`Ellipsis` object is replaced with as + many full slice (``:``) objects as needed to make the length of the + selection tuple :math:`N`. + +- If the selection tuple is smaller than *N*, then as many ``:`` + objects as needed are added to the end of the selection tuple so + that the modified selection tuple has length *N*. + +- All the integer indexing arrays must be :ref:`broadcastable + ` to the same shape. + +- The shape of the output (or the needed shape of the object to be used + for setting) is the broadcasted shape. + +- After expanding any ellipses and filling out any missing ``:`` + objects in the selection tuple, then let :math:`N_t` be the number + of indexing arrays, and let :math:`N_s = N - N_t` be the number of + slice objects. Note that :math:`N_t > 0` (or we wouldn't be doing + advanced integer indexing). + +- If :math:`N_s = 0` then the *M*-dimensional result is constructed by + varying the index tuple ``(i_1, ..., i_M)`` over the range + of the result shape and for each value of the index tuple + ``(ind_1, ..., ind_M)``:: + + result[i_1, ..., i_M] == x[ind_1[i_1, ..., i_M], ind_2[i_1, ..., i_M], + ..., ind_N[i_1, ..., i_M]] + + .. admonition:: Example + + Suppose the shape of the broadcasted indexing arrays is 3-dimensional + and *N* is 2. Then the result is found by letting *i, j, k* run over + the shape found by broadcasting ``ind_1`` and ``ind_2``, and each + *i, j, k* yields:: + + result[i,j,k] = x[ind_1[i,j,k], ind_2[i,j,k]] + +- If :math:`N_s > 0`, then partial indexing is done. This can be + somewhat mind-boggling to understand, but if you think in terms of + the shapes of the arrays involved, it can be easier to grasp what + happens. In simple cases (*i.e.* one indexing array and *N - 1* slice + objects) it does exactly what you would expect (concatenation of + repeated application of basic slicing). The rule for partial + indexing is that the shape of the result (or the interpreted shape + of the object to be used in setting) is the shape of *x* with the + indexed subspace replaced with the broadcasted indexing subspace. If + the index subspaces are right next to each other, then the + broadcasted indexing space directly replaces all of the indexed + subspaces in *x*. If the indexing subspaces are separated (by slice + objects), then the broadcasted indexing space is first, followed by + the sliced subspace of *x*. + + .. admonition:: Example + + Suppose ``x.shape`` is (10,20,30) and ``ind`` is a (2,3,4)-shaped + indexing :class:`intp` array, then ``result = x[...,ind,:]`` has + shape (10,2,3,4,30) because the (20,)-shaped subspace has been + replaced with a (2,3,4)-shaped broadcasted indexing subspace. If + we let *i, j, k* loop over the (2,3,4)-shaped subspace then + ``result[...,i,j,k,:] = x[...,ind[i,j,k],:]``. This example + produces the same result as :meth:`x.take(ind, axis=-2) `. + + .. admonition:: Example + + Now let ``x.shape`` be (10,20,30,40,50) and suppose ``ind_1`` + and ``ind_2`` are broadcastable to the shape (2,3,4). Then + ``x[:,ind_1,ind_2]`` has shape (10,2,3,4,40,50) because the + (20,30)-shaped subspace from X has been replaced with the + (2,3,4) subspace from the indices. However, + ``x[:,ind_1,:,ind_2]`` has shape (2,3,4,10,30,50) because there + is no unambiguous place to drop in the indexing subspace, thus + it is tacked-on to the beginning. It is always possible to use + :meth:`.transpose() ` to move the subspace + anywhere desired. (Note that this example cannot be replicated + using :func:`take`.) + + +Boolean +^^^^^^^ + +This advanced indexing occurs when obj is an array object of Boolean +type (such as may be returned from comparison operators). It is always +equivalent to (but faster than) ``x[obj.nonzero()]`` where, as +described above, :meth:`obj.nonzero() ` returns a +tuple (of length :attr:`obj.ndim `) of integer index +arrays showing the :const:`True` elements of *obj*. + +The special case when ``obj.ndim == x.ndim`` is worth mentioning. In +this case ``x[obj]`` returns a 1-dimensional array filled with the +elements of *x* corresponding to the :const:`True` values of *obj*. +The search order will be C-style (last index varies the fastest). If +*obj* has :const:`True` values at entries that are outside of the +bounds of *x*, then an index error will be raised. + +You can also use Boolean arrays as element of the selection tuple. In +such instances, they will always be interpreted as :meth:`nonzero(obj) +` and the equivalent integer indexing will be +done. + +.. warning:: + + The definition of advanced indexing means that ``x[(1,2,3),]`` is + fundamentally different than ``x[(1,2,3)]``. The latter is + equivalent to ``x[1,2,3]`` which will trigger basic selection while + the former will trigger advanced indexing. Be sure to understand + why this is occurs. + + Also recognize that ``x[[1,2,3]]`` will trigger advanced indexing, + whereas ``x[[1,2,slice(None)]]`` will trigger basic slicing. + +.. note:: + + XXX: this section may need some tuning... + Also the above warning needs explanation as the last part is at odds + with the definition of basic indexing. + + +.. _arrays.indexing.rec: + +Record Access +------------- + +.. seealso:: :ref:`arrays.dtypes`, :ref:`arrays.scalars` + +If the :class:`ndarray` object is a record array, *i.e.* its data type +is a :term:`record` data type, the :term:`fields ` of the array +can be accessed by indexing the array with strings, dictionary-like. + +Indexing ``x['field-name']`` returns a new :term:`view` to the array, +which is of the same shape as *x* (except when the field is a +sub-array) but of data type ``x.dtype['field-name']`` and contains +only the part of the data in the specified field. Also record array +scalars can be "indexed" this way. + +If the accessed field is a sub-array, the dimensions of the sub-array +are appended to the shape of the result. + +.. admonition:: Example + + >>> x = np.zeros((2,2), dtype=[('a', np.int32), ('b', np.float64, (3,3))]) + >>> x['a'].shape + (2, 2) + >>> x['a'].dtype + dtype('int32') + >>> x['b'].shape + (2, 2, 3, 3) + >>> x['b'].dtype + dtype('float64') + + +Flat Iterator indexing +---------------------- + +:attr:`x.flat ` returns an iterator that will iterate +over the entire array (in C-contiguous style with the last index +varying the fastest). This iterator object can also be indexed using +basic slicing or advanced indexing as long as the selection object is +not a tuple. This should be clear from the fact that :attr:`x.flat +` is a 1-dimensional view. It can be used for integer +indexing with 1-dimensional C-style-flat indices. The shape of any +returned array is therefore the shape of the integer indexing object. + +.. index:: + single: indexing + single: ndarray Added: numpy-docs/trunk/source/reference/arrays.interface.rst =================================================================== --- numpy-docs/trunk/source/reference/arrays.interface.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/arrays.interface.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,210 @@ +.. index:: + pair: array; interface + pair: array; protocol + +.. _arrays.interface: + +******************* +The Array Interface +******************* + +:version: 3 + +The array interface (sometimes called array protocol) was created in +2005 as a means for array-like Python objects to re-use each other's +data buffers intelligently whenever possible. The homogeneous +N-dimensional array interface is a default mechanism for objects to +share N-dimensional array memory and information. The interface +consists of a Python-side and a C-side using two attributes. Objects +wishing to be considered an N-dimensional array in application code +should support at least one of these attributes. Objects wishing to +support an N-dimensional array in application code should look for at +least one of these attributes and use the information provided +appropriately. + +This interface describes homogeneous arrays in the sense that each +item of the array has the same "type". This type can be very simple +or it can be a quite arbitrary and complicated C-like structure. + +There are two ways to use the interface: A Python side and a C-side. +Both are separate attributes. + +.. note:: + + An alternative to the array interface; + :cfunc:`The Revised Buffer Protocol `, :pep:`3118` + is introduced in Python 2.6. + +Python side +=========== + +This approach to the interface consists of the object having an +:data:`__array_interface__` attribute. + +.. data:: __array_interface__ + + A dictionary of items (3 required and 5 optional). The optional + keys in the dictionary have implied defaults if they are not + provided. + + The keys are: + + **shape** (required) + + Tuple whose elements are the array size in each dimension. Each + entry is an integer (a Python int or long). Note that these + integers could be larger than the platform "int" or "long" + could hold (a Python int is a C long). It is up to the code + using this attribute to handle this appropriately; either by + raising an error when overflow is possible, or by using + :cdata:`Py_LONG_LONG` as the C type for the shapes. + + **typestr** (required) + + A string providing the basic type of the homogenous array The + basic string format consists of 3 parts: a character describing + the byteorder of the data (``<``: little-endian, ``>``: + big-endian, ``|``: not-relevant), a character code giving the + basic type of the array, and an integer providing the number of + bytes the type uses. + + The basic type character codes are: + + ===== ================================================================ + ``t`` Bit field (following integer gives the number of + bits in the bit field). + ``b`` Boolean (integer type where all values are only True or False) + ``i`` Integer + ``u`` Unsigned integer + ``f`` Floating point + ``c`` Complex floating point + ``O`` Object (i.e. the memory contains a pointer to :ctype:`PyObject`) + ``S`` String (fixed-length sequence of char) + ``U`` Unicode (fixed-length sequence of :ctype:`Py_UNICODE`) + ``V`` Other (void \* -- each item is a fixed-size chunk of memory) + ===== ================================================================ + + **descr** (optional) + + A list of tuples providing a more detailed description of the + memory layout for each item in the homogeneous array. Each + tuple in the list has two or three elements. Normally, this + attribute would be used when *typestr* is ``V[0-9]+``, but this is + not a requirement. The only requirement is that the number of + bytes represented in the *typestr* key is the same as the total + number of bytes represented here. The idea is to support + descriptions of C-like structs (records) that make up array + elements. The elements of each tuple in the list are + + 1. A string providing a name associated with this portion of + the record. This could also be a tuple of ``('full name', + 'basic_name')`` where basic name would be a valid Python + variable name representing the full name of the field. + + 2. Either a basic-type description string as in *typestr* or + another list (for nested records) + + 3. An optional shape tuple providing how many times this part + of the record should be repeated. No repeats are assumed + if this is not given. Very complicated structures can be + described using this generic interface. Notice, however, + that each element of the array is still of the same + data-type. Some examples of using this interface are given + below. + + **Default**: ``[('', typestr)]`` + + **data** (optional) + + A 2-tuple whose first argument is an integer (a long integer + if necessary) that points to the data-area storing the array + contents. This pointer must point to the first element of + data (in other words any offset is always ignored in this + case). The second entry in the tuple is a read-only flag (true + means the data area is read-only). + + This attribute can also be an object exposing the + :cfunc:`buffer interface ` which + will be used to share the data. If this key is not present (or + returns :class:`None`), then memory sharing will be done + through the buffer interface of the object itself. In this + case, the offset key can be used to indicate the start of the + buffer. A reference to the object exposing the array interface + must be stored by the new object if the memory area is to be + secured. + + **Default**: :const:`None` + + **strides** (optional) + + Either :const:`None` to indicate a C-style contiguous array or + a Tuple of strides which provides the number of bytes needed + to jump to the next array element in the corresponding + dimension. Each entry must be an integer (a Python + :const:`int` or :const:`long`). As with shape, the values may + be larger than can be represented by a C "int" or "long"; the + calling code should handle this appropiately, either by + raising an error, or by using :ctype:`Py_LONG_LONG` in C. The + default is :const:`None` which implies a C-style contiguous + memory buffer. In this model, the last dimension of the array + varies the fastest. For example, the default strides tuple + for an object whose array entries are 8 bytes long and whose + shape is (10,20,30) would be (4800, 240, 8) + + **Default**: :const:`None` (C-style contiguous) + + **mask** (optional) + + :const:`None` or an object exposing the array interface. All + elements of the mask array should be interpreted only as true + or not true indicating which elements of this array are valid. + The shape of this object should be `"broadcastable" + ` to the shape of the + original array. + + **Default**: :const:`None` (All array values are valid) + + **offset** (optional) + + An integer offset into the array data region. This can only be + used when data is :const:`None` or returns a :class:`buffer` + object. + + **Default**: 0. + + **version** (required) + + An integer showing the version of the interface (i.e. 3 for + this version). Be careful not to use this to invalidate + objects exposing future versions of the interface. + + +C-struct access +=============== + +This approach to the array interface allows for faster access to an +array using only one attribute lookup and a well-defined C-structure. + +.. cvar:: __array_struct__ + + A :ctype:`PyCObject` whose :cdata:`voidptr` member contains a + pointer to a filled :ctype:`PyArrayInterface` structure. Memory + for the structure is dynamically created and the :ctype:`PyCObject` + is also created with an appropriate destructor so the retriever of + this attribute simply has to apply :cfunc:`Py_DECREF()` to the + object returned by this attribute when it is finished. Also, + either the data needs to be copied out, or a reference to the + object exposing this attribute must be held to ensure the data is + not freed. Objects exposing the :obj:`__array_struct__` interface + must also not reallocate their memory if other objects are + referencing them. + +.. admonition:: New since June 16, 2006: + + In the past most implementations used the "desc" member of the + :ctype:`PyCObject` itself (do not confuse this with the "descr" member of + the :ctype:`PyArrayInterface` structure above --- they are two separate + things) to hold the pointer to the object exposing the interface. + This is now an explicit part of the interface. Be sure to own a + reference to the object when the :ctype:`PyCObject` is created using + :ctype:`PyCObject_FromVoidPtrAndDesc`. Added: numpy-docs/trunk/source/reference/arrays.ndarray.rst =================================================================== --- numpy-docs/trunk/source/reference/arrays.ndarray.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/arrays.ndarray.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,529 @@ +.. _arrays.ndarray: + +****************************************** +The N-dimensional array (:class:`ndarray`) +****************************************** + +.. currentmodule:: numpy + +An :class:`ndarray` is a (usually fixed-size) multidimensional +container of items of the same type and size. The number of dimensions +and items in an array is defined by its :attr:`shape `, +which is a :class:`tuple` of *N* integers that specify the sizes of +each dimension. The type of items in the array is specified by a +separate :ref:`data-type object (dtype) `, one of which +is associated with each ndarray. + +As with other container objects in Python, the contents of a +:class:`ndarray` can be accessed and modified by :ref:`indexing or +slicing ` the array (using for example *N* integers), +and via the methods and attributes of the :class:`ndarray`. + +.. index:: view, base + +Different :class:`ndarrays ` can share the same data, so that +changes made in one :class:`ndarray` may be visible in another. That +is, an ndarray can be a *"view"* to another ndarray, and the data it +is referring to is taken care of by the *"base"* ndarray. ndarrays can +also be views to memory owned by Python :class:`strings ` or +objects implementing the :class:`buffer` or :ref:`array +` interfaces. + + +.. admonition:: Example + + A 2-dimensional array of size 2 x 3, composed of 4-byte integer elements: + + >>> x = np.array([[1, 2, 3], [4, 5, 6]], np.int32) + >>> type(x) + + >>> x.shape + (2, 3) + >>> x.dtype + dtype('int32') + + The array can be indexed using a Python container-like syntax: + + >>> x[1,2] + 6 + + For example :ref:`slicing ` can produce views of the array: + + >>> y = x[:,1] + >>> y[0] = 9 + >>> x + array([[1, 9, 3], + [4, 5, 6]]) + + +Constructing arrays +=================== + +New arrays can be constructed using the routines detailed in +:ref:`routines.array-creation`, and also by using the low-level +:class:`ndarray` constructor: + +.. autosummary:: + :toctree: generated/ + + ndarray + +.. _arrays.ndarray.indexing: + + +Indexing arrays +=============== + +Arrays can be indexed using an extended Python slicing syntax, +``array[selection]``. Similar syntax is also used for accessing +fields in a :ref:`record array `. + +.. seealso:: :ref:`Array Indexing `. + +Internal memory layout of an ndarray +==================================== + +An instance of class :class:`ndarray` consists of a contiguous +one-dimensional segment of computer memory (owned by the array, or by +some other object), combined with an indexing scheme that maps *N* +integers into the location of an item in the block. The ranges in +which the indices can vary is specified by the :obj:`shape +` of the array. How many bytes each item takes and how +the bytes are interpreted is defined by the :ref:`data-type object +` associated with the array. + +.. index:: C-order, Fortran-order, row-major, column-major, stride, offset + +A segment of memory is inherently 1-dimensional, and there are many +different schemes of arranging the items of an *N*-dimensional array to +a 1-dimensional block. Numpy is flexible, and :class:`ndarray` objects +can accommodate any *strided indexing scheme*. In a strided scheme, +the N-dimensional index :math:`(n_0, n_1, ..., n_{N-1})` corresponds +to the offset (in bytes) + +.. math:: n_{\mathrm{offset}} = \sum_{k=0}^{N-1} s_k n_k + +from the beginning of the memory block associated with the +array. Here, :math:`s_k` are integers which specify the :obj:`strides +` of the array. The :term:`column-major` order (used +for example in the Fortran language and in *Matlab*) and +:term:`row-major` order (used in C) are special cases of the strided +scheme, and correspond to the strides: + +.. math:: + + s_k^{\mathrm{column}} = \prod_{j=0}^{k-1} d_j , \quad s_k^{\mathrm{row}} = \prod_{j=k+1}^{N-1} d_j . + +.. index:: single-segment, contiguous, non-contiguous + +Both the C and Fortran orders are :term:`contiguous`, *i.e.* +:term:`single-segment`, memory layouts, in which every part of the +memory block can be accessed by some combination of the indices. + +Data in new :class:`ndarrays ` is in the :term:`row-major` +(C) order, unless otherwise specified, but for example :ref:`basic +array slicing ` often produces :term:`views ` +in a different scheme. + +.. seealso: :ref:`Indexing `_ + +.. note:: + + Several algorithms in NumPy work on arbitrarily strided arrays. + However, some algorithms require single-segment arrays. When an + irregularly strided array is passed in to such algorithms, a copy + is automatically made. + + +Array attributes +================ + +Array attributes reflect information that is intrinsic to the array +itself. Generally, accessing an array through its attributes allows +you to get and sometimes set intrinsic properties of the array without +creating a new array. The exposed attributes are the core parts of an +array and only some of them can be reset meaningfully without creating +a new array. Information on each attribute is given below. + +Memory layout +------------- + +The following attributes contain information about the memory layout +of the array: + +.. autosummary:: + :toctree: generated/ + + ndarray.flags + ndarray.shape + ndarray.strides + ndarray.ndim + ndarray.data + ndarray.size + ndarray.itemsize + ndarray.nbytes + ndarray.base + +.. note:: XXX: update and check these docstrings. + +Data type +--------- + +.. seealso:: :ref:`Data type objects ` + +The data type object associated with the array can be found in the +:attr:`dtype ` attribute: + +.. autosummary:: + :toctree: generated/ + + ndarray.dtype + +.. note:: XXX: update the dtype attribute docstring: setting etc. + +Other attributes +---------------- + +.. autosummary:: + :toctree: generated/ + + ndarray.T + ndarray.real + ndarray.imag + ndarray.flat + ndarray.ctypes + __array_priority__ + + +.. _arrays.ndarray.array-interface: + +Array interface +--------------- + +.. seealso:: :ref:`arrays.interface`. + +========================== =================================== +:obj:`__array_interface__` Python-side of the array interface +:obj:`__array_struct__` C-side of the array interface +========================== =================================== + +:mod:`ctypes` foreign function interface +---------------------------------------- + +.. autosummary:: + :toctree: generated/ + + ndarray.ctypes + +.. note:: XXX: update and check these docstrings. + +Array methods +============= + +An :class:`ndarray` object has many methods which operate on or with +the array in some fashion, typically returning an array result. These +methods are explained below. + +For the following methods there are also corresponding functions in +:mod:`numpy`: :func:`all`, :func:`any`, :func:`argmax`, +:func:`argmin`, :func:`argsort`, :func:`choose`, :func:`clip`, +:func:`compress`, :func:`copy`, :func:`cumprod`, :func:`cumsum`, +:func:`diagonal`, :func:`imag`, :func:`max `, :func:`mean`, +:func:`min `, :func:`nonzero`, :func:`prod`, :func:`ptp`, :func:`put`, +:func:`ravel`, :func:`real`, :func:`repeat`, :func:`reshape`, +:func:`round `, :func:`searchsorted`, :func:`sort`, :func:`squeeze`, +:func:`std`, :func:`sum`, :func:`swapaxes`, :func:`take`, +:func:`trace`, :func:`transpose`, :func:`var`. + +Array conversion +---------------- + +.. autosummary:: + :toctree: generated/ + + ndarray.item + ndarray.tolist + ndarray.itemset + ndarray.tostring + ndarray.tofile + ndarray.dump + ndarray.dumps + ndarray.astype + ndarray.byteswap + ndarray.copy + ndarray.view + ndarray.getfield + ndarray.setflags + ndarray.fill + +.. note:: XXX: update and check these docstrings. + +Shape manipulation +------------------ + +For reshape, resize, and transpose, the single tuple argument may be +replaced with ``n`` integers which will be interpreted as an n-tuple. + +.. autosummary:: + :toctree: generated/ + + ndarray.reshape + ndarray.resize + ndarray.transpose + ndarray.swapaxes + ndarray.flatten + ndarray.ravel + ndarray.squeeze + +Item selection and manipulation +------------------------------- + +For array methods that take an *axis* keyword, it defaults to +:const:`None`. If axis is *None*, then the array is treated as a 1-D +array. Any other value for *axis* represents the dimension along which +the operation should proceed. + +.. autosummary:: + :toctree: generated/ + + ndarray.take + ndarray.put + ndarray.repeat + ndarray.choose + ndarray.sort + ndarray.argsort + ndarray.searchsorted + ndarray.nonzero + ndarray.compress + ndarray.diagonal + +Calculation +----------- + +.. index:: axis + +Many of these methods take an argument named *axis*. In such cases, + +- If *axis* is *None* (the default), the array is treated as a 1-D + array and the operation is performed over the entire array. This + behavior is also the default if self is a 0-dimensional array or + array scalar. + +- If *axis* is an integer, then the operation is done over the given axis + (for each 1-D subarray that can be created along the given axis). + +The parameter *dtype* specifies the data type over which a reduction +operation (like summing) should take place. The default reduce data +type is the same as the data type of *self*. To avoid overflow, it can +be useful to perform the reduction using a larger data type. + +For several methods, an optional *out* argument can also be provided +and the result will be placed into the output array given. The *out* +argument must be an :class:`ndarray` and have the same number of +elements. It can have a different data type in which case casting will +be performed. + + +.. autosummary:: + :toctree: generated/ + + ndarray.argmax + ndarray.min + ndarray.argmin + ndarray.ptp + ndarray.clip + ndarray.conj + ndarray.round + ndarray.trace + ndarray.sum + ndarray.cumsum + ndarray.mean + ndarray.var + ndarray.std + ndarray.prod + ndarray.cumprod + ndarray.all + ndarray.any + +Arithmetic and comparison operations +==================================== + +.. note:: XXX: write all attributes explicitly here instead of relying on + the auto\* stuff? + +.. index:: comparison, arithmetic, operation, operator + +Arithmetic and comparison operations on :class:`ndarrays ` +are defined as element-wise operations, and generally yield +:class:`ndarray` objects as results. + +Each of the arithmetic operations (``+``, ``-``, ``*``, ``/``, ``//``, +``%``, ``divmod()``, ``**`` or ``pow()``, ``<<``, ``>>``, ``&``, +``^``, ``|``, ``~``) and the comparisons (``==``, ``<``, ``>``, +``<=``, ``>=``, ``!=``) is equivalent to the corresponding +:term:`universal function` (or :term:`ufunc` for short) in Numpy. For +more information, see the section on :ref:`Universal Functions +`. + +Comparison operators: + +.. autosummary:: + :toctree: generated/ + + ndarray.__lt__ + ndarray.__le__ + ndarray.__gt__ + ndarray.__ge__ + ndarray.__eq__ + ndarray.__ne__ + +Truth value of an array (:func:`bool()`): + +.. autosummary:: + :toctree: generated/ + + ndarray.__nonzero__ + +.. note:: + + Truth-value testing of an array invokes + :meth:`ndarray.__nonzero__`, which raises an error if the number of + elements in the the array is larger than 1, because the truth value + of such arrays is ambiguous. Use :meth:`.any() ` and + :meth:`.all() ` instead to be clear about what is meant in + such cases. (If the number of elements is 0, the array evaluates to + ``False``.) + + +Unary operations: + +.. autosummary:: + :toctree: generated/ + + ndarray.__neg__ + ndarray.__pos__ + ndarray.__abs__ + ndarray.__invert__ + +Arithmetic: + +.. autosummary:: + :toctree: generated/ + + ndarray.__add__ + ndarray.__sub__ + ndarray.__mul__ + ndarray.__div__ + ndarray.__truediv__ + ndarray.__floordiv__ + ndarray.__mod__ + ndarray.__divmod__ + ndarray.__pow__ + ndarray.__lshift__ + ndarray.__rshift__ + ndarray.__and__ + ndarray.__or__ + ndarray.__xor__ + +.. note:: + + - Any third argument to :func:`pow()` is silently ignored, + as the underlying :func:`ufunc ` only takes two arguments. + + - The three division operators are all defined; :obj:`div` is active + by default, :obj:`truediv` is active when + :obj:`__future__` division is in effect. + + - Because :class:`ndarray` is a built-in type (written in C), the + ``__r{op}__`` special methods are not directly defined. + + - The functions called to implement many arithmetic special methods + for arrays can be modified using :func:`set_numeric_ops`. + +Arithmetic, in-place: + +.. autosummary:: + :toctree: generated/ + + ndarray.__iadd__ + ndarray.__isub__ + ndarray.__imul__ + ndarray.__idiv__ + ndarray.__itruediv__ + ndarray.__ifloordiv__ + ndarray.__imod__ + ndarray.__ipow__ + ndarray.__ilshift__ + ndarray.__irshift__ + ndarray.__iand__ + ndarray.__ior__ + ndarray.__ixor__ + +.. warning:: + + In place operations will perform the calculation using the + precision decided by the data type of the two operands, but will + silently downcast the result (if necessary) so it can fit back into + the array. Therefore, for mixed precision calculations, ``A {op}= + B`` can be different than ``A = A {op} B``. For example, suppose + ``a = ones((3,3))``. Then, ``a += 3j`` is different than ``a = a + + 3j``: While they both perform the same computation, ``a += 3`` + casts the result to fit back in ``a``, whereas ``a = a + 3j`` + re-binds the name ``a`` to the result. + + +Special methods +=============== + +For standard library functions: + +.. autosummary:: + :toctree: generated/ + + ndarray.__copy__ + ndarray.__deepcopy__ + ndarray.__reduce__ + ndarray.__setstate__ + +Basic customization: + +.. autosummary:: + :toctree: generated/ + + ndarray.__new__ + ndarray.__array__ + ndarray.__array_wrap__ + +Container customization: (see :ref:`Indexing `) + +.. autosummary:: + :toctree: generated/ + + ndarray.__len__ + ndarray.__getitem__ + ndarray.__setitem__ + ndarray.__getslice__ + ndarray.__setslice__ + ndarray.__contains__ + +Conversion; the operations :func:`complex()`, :func:`int()`, +:func:`long()`, :func:`float()`, :func:`oct()`, and +:func:`hex()`. They work only on arrays that have one element in them +and return the appropriate scalar. + +.. autosummary:: + :toctree: generated/ + + ndarray.__int__ + ndarray.__long__ + ndarray.__float__ + ndarray.__oct__ + ndarray.__hex__ + +String representations: + +.. autosummary:: + :toctree: generated/ + + ndarray.__str__ + ndarray.__repr__ Added: numpy-docs/trunk/source/reference/arrays.rst =================================================================== --- numpy-docs/trunk/source/reference/arrays.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/arrays.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,46 @@ +.. _arrays: + +************* +Array objects +************* + +.. currentmodule:: numpy + +NumPy provides an N-dimensional array type, the :ref:`ndarray +`, which describes a collection of "items" of the same +type. The items can be :ref:`indexed ` using for +example N integers. + +All ndarrays are :term:`homogenous`: every item takes up the same size +block of memory, and all blocks are interpreted in exactly the same +way. How each item in the array is to be interpreted is specified by a +separate :ref:`data-type object `, one of which is associated +with every array. In addition to basic types (integers, floats, +*etc.*), the data type objects can also represent data structures. + +An item extracted from an array, *e.g.*, by indexing, is represented +by a Python object whose type is one of the :ref:`array scalar types +` built in Numpy. The array scalars allow easy manipulation +of also more complicated arrangements of data. + +.. figure:: figures/threefundamental.png + + **Figure** + Conceptual diagram showing the relationship between the three + fundamental objects used to describe the data in an array: 1) the + ndarray itself, 2) the data-type object that describes the layout + of a single fixed-size element of the array, 3) the array-scalar + Python object that is returned when a single element of the array + is accessed. + + + +.. toctree:: + :maxdepth: 2 + + arrays.ndarray + arrays.scalars + arrays.dtypes + arrays.indexing + arrays.classes + arrays.interface Added: numpy-docs/trunk/source/reference/arrays.scalars.rst =================================================================== --- numpy-docs/trunk/source/reference/arrays.scalars.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/arrays.scalars.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,288 @@ +.. _arrays.scalars: + +******* +Scalars +******* + +.. currentmodule:: numpy + +Python defines only one type of a particular data class (there is only +one integer type, one floating-point type, etc.). This can be +convenient in applications that don't need to be concerned with all +the ways data can be represented in a computer. For scientific +computing, however, more control is often needed. + +In NumPy, there are 21 new fundamental Python types to describe +different types of scalars. These type descriptors are mostly based on +the types available in the C language that CPython is written in, with +several additional types compatible with Python's types. + +Array scalars have the same attributes and methods as :class:`ndarrays +`. [#]_ This allows one to treat items of an array partly on +the same footing as arrays, smoothing out rough edges that result when +mixing scalar and array operations. + +Array scalars live in a hierarchy (see the Figure below) of data +types. They can be detected using the hierarchy: For example, +``isinstance(val, np.generic)`` will return :const:`True` if *val* is +an array scalar object. Alternatively, what kind of array scalar is +present can be determined using other members of the data type +hierarchy. Thus, for example ``isinstance(val, np.complexfloating)`` +will return :const:`True` if *val* is a complex valued type, while +:const:`isinstance(val, np.flexible)` will return true if *val* is one +of the flexible itemsize array types (:class:`string`, +:class:`unicode`, :class:`void`). + +.. figure:: figures/dtype-hierarchy.png + + **Figure:** Hierarchy of type objects representing the array data + types. Not shown are the two integer types :class:`intp` and + :class:`uintp` which just point to the integer type that holds a + pointer for the platform. All the number types can be obtained + using bit-width names as well. + +.. [#] However, array scalars are immutable, so that none of the array + scalar attributes are settable. + +.. _arrays.scalars.character-codes: + +.. _arrays.scalars.built-in: + +Built-in scalar types +===================== + +The built-in scalar types are shown below. Along with their (mostly) +C-derived names, the integer, float, and complex data-types are also +available using a bit-width convention so that an array of the right +size can always be ensured (e.g. :class:`int8`, :class:`float64`, +:class:`complex128`). Two aliases (:class:`intp` and :class:`uintp`) +pointing to the integer type that is sufficiently large to hold a C pointer +are also provided. The C-like names are associated with character codes, +which are shown in the table. Use of the character codes, however, +is discouraged. + +Five of the scalar types are essentially equivalent to fundamental +Python types and therefore inherit from them as well as from the +generic array scalar type: + +==================== ==================== +Array scalar type Related Python type +==================== ==================== +:class:`int_` :class:`IntType` +:class:`float_` :class:`FloatType` +:class:`complex_` :class:`ComplexType` +:class:`str_` :class:`StringType` +:class:`unicode_` :class:`UnicodeType` +==================== ==================== + +The :class:`bool_` data type is very similar to the Python +:class:`BooleanType` but does not inherit from it because Python's +:class:`BooleanType` does not allow itself to be inherited from, and +on the C-level the size of the actual bool data is not the same as a +Python Boolean scalar. + +.. warning:: + + The :class:`bool_` type is not a subclass of the :class:`int_` type + (the :class:`bool_` is not even a number type). This is different + than Python's default implementation of :class:`bool` as a + sub-class of int. + + +.. tip:: The default data type in Numpy is :class:`float_`. + +In the tables below, ``platform?`` means that the type may not +available on all platforms. Compatibility with different C or Python +types is indicated: two types are compatible if their data is of the +same size and interpreted in the same way. + +Booleans: + +=================== ============================= =============== +Type Remarks Character code +=================== ============================= =============== +:class:`bool_` compatible: Python bool ``'?'`` +:class:`bool8` 8 bits +=================== ============================= =============== + +Integers: + +=================== ============================= =============== +:class:`byte` compatible: C char ``'b'`` +:class:`short` compatible: C short ``'h'`` +:class:`intc` compatible: C int ``'i'`` +:class:`int_` compatible: Python int ``'l'`` +:class:`longlong` compatible: C long long ``'q'`` +:class:`intp` large enough to fit a pointer ``'p'`` +:class:`int8` 8 bits +:class:`int16` 16 bits +:class:`int32` 32 bits +:class:`int64` 64 bits +=================== ============================= =============== + +Unsigned integers: + +=================== ============================= =============== +:class:`ubyte` compatible: C unsigned char ``'B'`` +:class:`ushort` compatible: C unsigned short ``'H'`` +:class:`uintc` compatible: C unsigned int ``'I'`` +:class:`uint` compatible: Python int ``'L'`` +:class:`ulonglong` compatible: C long long ``'Q'`` +:class:`uintp` large enough to fit a pointer ``'P'`` +:class:`uint8` 8 bits +:class:`uint16` 16 bits +:class:`uint32` 32 bits +:class:`uint64` 64 bits +=================== ============================= =============== + +Floating-point numbers: + +=================== ============================= =============== +:class:`single` compatible: C float ``'f'`` +:class:`double` compatible: C double +:class:`float_` compatible: Python float ``'d'`` +:class:`longfloat` compatible: C long float ``'g'`` +:class:`float32` 32 bits +:class:`float64` 64 bits +:class:`float96` 92 bits, platform? +:class:`float128` 128 bits, platform? +=================== ============================= =============== + +Complex floating-point numbers: + +=================== ============================= =============== +:class:`csingle` ``'F'`` +:class:`complex_` compatible: Python complex ``'D'`` +:class:`clongfloat` ``'G'`` +:class:`complex64` two 32-bit floats +:class:`complex128` two 64-bit floats +:class:`complex192` two 96-bit floats, + platform? +:class:`complex256` two 128-bit floats, + platform? +=================== ============================= =============== + +Any Python object: + +=================== ============================= =============== +:class:`object_` any Python object ``'O'`` +=================== ============================= =============== + +.. note:: + + The data actually stored in :term:`object arrays ` + (*i.e.* arrays having dtype :class:`object_`) are references to + Python objects, not the objects themselves. Hence, object arrays + behave more like usual Python :class:`lists `, in the sense + that their contents need not be of the same Python type. + + The object type is also special because an array containing + :class:`object_` items does not return an :class:`object_` object + on item access, but instead returns the actual object that + the array item refers to. + +The following data types are :term:`flexible`. They have no predefined +size: the data they describe can be of different length in different +arrays. (In the character codes ``#`` is an integer denoting how many +elements the data type consists of.) + +=================== ============================= ======== +:class:`str_` compatible: Python str ``'S#'`` +:class:`unicode_` compatible: Python unicode ``'U#'`` +:class:`void` ``'V#'`` +=================== ============================= ======== + + +.. warning:: + + Numeric Compatibility: If you used old typecode characters in your + Numeric code (which was never recommended), you will need to change + some of them to the new characters. In particular, the needed + changes are ``c -> S1``, ``b -> B``, ``1 -> b``, ``s -> h``, ``w -> + H``, and ``u -> I``. These changes make the type character + convention more consistent with other Python modules such as the + :mod:`struct` module. + + +.. note:: XXX: what to put in the type docstrings, and where to put them? + +Attributes +========== + +The array scalar objects have an :obj:`array priority +<__array_priority__>` of :cdata:`NPY_SCALAR_PRIORITY` +(-1,000,000.0). They also do not (yet) have a :attr:`ctypes ` +attribute. Otherwise, they share the same attributes as arrays: + +.. autosummary:: + :toctree: generated/ + + generic.flags + generic.shape + generic.strides + generic.ndim + generic.data + generic.size + generic.itemsize + generic.base + generic.dtype + generic.real + generic.imag + generic.flat + generic.T + generic.__array_interface__ + generic.__array_struct__ + generic.__array_priority__ + generic.__array_wrap__ + +.. note:: XXX: import the documentation into the docstrings? + +Indexing +======== +.. seealso:: :ref:`arrays.indexing`, :ref:`arrays.dtypes` + +Array scalars can be indexed like 0-dimensional arrays: if *x* is an +array scalar, + +- ``x[()]`` returns a 0-dimensional :class:`ndarray` +- ``x['field-name']`` returns the array scalar in the field *field-name*. + (*x* can have fields, for example, when it corresponds to a record data type.) + +Methods +======= + +Array scalars have exactly the same methods as arrays. The default +behavior of these methods is to internally convert the scalar to an +equivalent 0-dimensional array and to call the corresponding array +method. In addition, math operations on array scalars are defined so +that the same hardware flags are set and used to interpret the results +as for :ref:`ufunc `, so that the error state used for ufuncs +also carries over to the math on array scalars. + +The exceptions to the above rules are given below: + +.. autosummary:: + :toctree: generated/ + + generic + generic.__array__ + generic.__array_wrap__ + generic.__squeeze__ + generic.byteswap + generic.__reduce__ + generic.__setstate__ + generic.setflags + +.. note:: XXX: import the documentation into the docstrings? + +Defining new types +================== + +There are two ways to effectively define a new array scalar type +(apart from composing record :ref:`dtypes ` from the built-in +scalar types): One way is to simply subclass the :class:`ndarray` and +overwrite the methods of interest. This will work to a degree, but +internally certain behaviors are fixed by the data type of the array. +To fully customize the data type of an array you need to define a new +data-type, and register it with NumPy. Such new types can only be +defined in C, using the :ref:`Numpy C-API `. Added: numpy-docs/trunk/source/reference/c-api.array.rst =================================================================== --- numpy-docs/trunk/source/reference/c-api.array.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/c-api.array.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,2635 @@ +Array API +========= + +.. sectionauthor:: Travis E. Oliphant + +| The test of a first-rate intelligence is the ability to hold two +| opposed ideas in the mind at the same time, and still retain the +| ability to function. +| --- *F. Scott Fitzgerald* + +| For a successful technology, reality must take precedence over public +| relations, for Nature cannot be fooled. +| --- *Richard P. Feynman* + +.. index:: + pair: ndarray; C-API + pair: C-API; array + + +Array structure and data access +------------------------------- + +These macros all access the :ctype:`PyArrayObject` structure members. The input +argument, obj, can be any :ctype:`PyObject *` that is directly interpretable +as a :ctype:`PyArrayObject *` (any instance of the :cdata:`PyArray_Type` and its +sub-types). + +.. cfunction:: void *PyArray_DATA(PyObject *obj) + +.. cfunction:: char *PyArray_BYTES(PyObject *obj) + + These two macros are similar and obtain the pointer to the + data-buffer for the array. The first macro can (and should be) + assigned to a particular pointer where the second is for generic + processing. If you have not guaranteed a contiguous and/or aligned + array then be sure you understand how to access the data in the + array to avoid memory and/or alignment problems. + +.. cfunction:: npy_intp *PyArray_DIMS(PyObject *arr) + +.. cfunction:: npy_intp *PyArray_STRIDES(PyObject* arr) + +.. cfunction:: npy_intp PyArray_DIM(PyObject* arr, int n) + + Return the shape in the *n* :math:`^{\textrm{th}}` dimension. + +.. cfunction:: npy_intp PyArray_STRIDE(PyObject* arr, int n) + + Return the stride in the *n* :math:`^{\textrm{th}}` dimension. + +.. cfunction:: PyObject *PyArray_BASE(PyObject* arr) + +.. cfunction:: PyArray_Descr *PyArray_DESCR(PyObject* arr) + +.. cfunction:: int PyArray_FLAGS(PyObject* arr) + +.. cfunction:: int PyArray_ITEMSIZE(PyObject* arr) + + Return the itemsize for the elements of this array. + +.. cfunction:: int PyArray_TYPE(PyObject* arr) + + Return the (builtin) typenumber for the elements of this array. + +.. cfunction:: PyObject *PyArray_GETITEM(PyObject* arr, void* itemptr) + + Get a Python object from the ndarray, *arr*, at the location + pointed to by itemptr. Return ``NULL`` on failure. + +.. cfunction:: int PyArray_SETITEM(PyObject* arr, void* itemptr, PyObject* obj) + + Convert obj and place it in the ndarray, *arr*, at the place + pointed to by itemptr. Return -1 if an error occurs or 0 on + success. + +.. cfunction:: npy_intp PyArray_SIZE(PyObject* arr) + + Returns the total size (in number of elements) of the array. + +.. cfunction:: npy_intp PyArray_Size(PyObject* obj) + + Returns 0 if *obj* is not a sub-class of bigndarray. Otherwise, + returns the total number of elements in the array. Safer version + of :cfunc:`PyArray_SIZE` (*obj*). + +.. cfunction:: npy_intp PyArray_NBYTES(PyObject* arr) + + Returns the total number of bytes consumed by the array. + + +Data access +^^^^^^^^^^^ + +These functions and macros provide easy access to elements of the +ndarray from C. These work for all arrays. You may need to take care +when accessing the data in the array, however, if it is not in machine +byte-order, misaligned, or not writeable. In other words, be sure to +respect the state of the flags unless you know what you are doing, or +have previously guaranteed an array that is writeable, aligned, and in +machine byte-order using :cfunc:`PyArray_FromAny`. If you wish to handle all +types of arrays, the copyswap function for each type is useful for +handling misbehaved arrays. Some platforms (e.g. Solaris) do not like +misaligned data and will crash if you de-reference a misaligned +pointer. Other platforms (e.g. x86 Linux) will just work more slowly +with misaligned data. + +.. cfunction:: void* PyArray_GetPtr(PyArrayObject* aobj, npy_intp* ind) + + Return a pointer to the data of the ndarray, *aobj*, at the + N-dimensional index given by the c-array, *ind*, (which must be + at least *aobj* ->nd in size). You may want to typecast the + returned pointer to the data type of the ndarray. + +.. cfunction:: void* PyArray_GETPTR1(PyObject* obj, i) + +.. cfunction:: void* PyArray_GETPTR2(PyObject* obj, i, j) + +.. cfunction:: void* PyArray_GETPTR3(PyObject* obj, i, j, k) + +.. cfunction:: void* PyArray_GETPTR4(PyObject* obj, i, j, k, l) + + Quick, inline access to the element at the given coordinates in + the ndarray, *obj*, which must have respectively 1, 2, 3, or 4 + dimensions (this is not checked). The corresponding *i*, *j*, + *k*, and *l* coordinates can be any integer but will be + interpreted as ``npy_intp``. You may want to typecast the + returned pointer to the data type of the ndarray. + + +Creating arrays +--------------- + + +From scratch +^^^^^^^^^^^^ + +.. cfunction:: PyObject* PyArray_NewFromDescr(PyTypeObject* subtype, PyArray_Descr* descr, int nd, npy_intp* dims, npy_intp* strides, void* data, int flags, PyObject* obj) + + This is the main array creation function. Most new arrays are + created with this flexible function. The returned object is an + object of Python-type *subtype*, which must be a subtype of + :cdata:`PyArray_Type`. The array has *nd* dimensions, described by + *dims*. The data-type descriptor of the new array is *descr*. If + *subtype* is not :cdata:`&PyArray_Type` (*e.g.* a Python subclass of + the ndarray), then *obj* is the object to pass to the + :obj:`__array_finalize__` method of the subclass. If *data* is + ``NULL``, then new memory will be allocated and *flags* can be + non-zero to indicate a Fortran-style contiguous array. If *data* + is not ``NULL``, then it is assumed to point to the memory to be + used for the array and the *flags* argument is used as the new + flags for the array (except the state of :cdata:`NPY_OWNDATA` and + :cdata:`UPDATEIFCOPY` flags of the new array will be reset). In + addition, if *data* is non-NULL, then *strides* can also be + provided. If *strides* is ``NULL``, then the array strides are + computed as C-style contiguous (default) or Fortran-style + contiguous (*flags* is nonzero for *data* = ``NULL`` or *flags* & + :cdata:`NPY_F_CONTIGUOUS` is nonzero non-NULL *data*). Any provided + *dims* and *strides* are copied into newly allocated dimension and + strides arrays for the new array object. + +.. cfunction:: PyObject* PyArray_New(PyTypeObject* subtype, int nd, npy_intp* dims, int type_num, npy_intp* strides, void* data, int itemsize, int flags, PyObject* obj) + + This is similar to :cfunc:`PyArray_DescrNew` (...) except you + specify the data-type descriptor with *type_num* and *itemsize*, + where *type_num* corresponds to a builtin (or user-defined) + type. If the type always has the same number of bytes, then + itemsize is ignored. Otherwise, itemsize specifies the particular + size of this array. + + + +.. warning:: + + If data is passed to :cfunc:`PyArray_NewFromDescr` or :cfunc:`PyArray_New`, + this memory must not be deallocated until the new array is + deleted. If this data came from another Python object, this can + be accomplished using :cfunc:`Py_INCREF` on that object and setting the + base member of the new array to point to that object. If strides + are passed in they must be consistent with the dimensions, the + itemsize, and the data of the array. + +.. cfunction:: PyObject* PyArray_SimpleNew(int nd, npy_intp* dims, int typenum) + + Create a new unitialized array of type, *typenum*, whose size in + each of *nd* dimensions is given by the integer array, *dims*. + This function cannot be used to create a flexible-type array (no + itemsize given). + +.. cfunction:: PyObject* PyArray_SimpleNewFromData(int nd, npy_intp* dims, int typenum, void* data) + + Create an array wrapper around *data* pointed to by the given + pointer. The array flags will have a default that the data area is + well-behaved and C-style contiguous. The shape of the array is + given by the *dims* c-array of length *nd*. The data-type of the + array is indicated by *typenum*. + +.. cfunction:: PyObject* PyArray_SimpleNewFromDescr(int nd, npy_intp* dims, PyArray_Descr* descr) + + Create a new array with the provided data-type descriptor, *descr* + , of the shape deteremined by *nd* and *dims*. + +.. cfunction:: PyArray_FILLWBYTE(PyObject* obj, int val) + + Fill the array pointed to by *obj* ---which must be a (subclass + of) bigndarray---with the contents of *val* (evaluated as a byte). + +.. cfunction:: PyObject* PyArray_Zeros(int nd, npy_intp* dims, PyArray_Descr* dtype, int fortran) + + Construct a new *nd* -dimensional array with shape given by *dims* + and data type given by *dtype*. If *fortran* is non-zero, then a + Fortran-order array is created, otherwise a C-order array is + created. Fill the memory with zeros (or the 0 object if *dtype* + corresponds to :ctype:`PyArray_OBJECT` ). + +.. cfunction:: PyObject* PyArray_ZEROS(int nd, npy_intp* dims, int type_num, int fortran) + + Macro form of :cfunc:`PyArray_Zeros` which takes a type-number instead + of a data-type object. + +.. cfunction:: PyObject* PyArray_Empty(int nd, npy_intp* dims, PyArray_Descr* dtype, int fortran) + + Construct a new *nd* -dimensional array with shape given by *dims* + and data type given by *dtype*. If *fortran* is non-zero, then a + Fortran-order array is created, otherwise a C-order array is + created. The array is uninitialized unless the data type + corresponds to :ctype:`PyArray_OBJECT` in which case the array is + filled with :cdata:`Py_None`. + +.. cfunction:: PyObject* PyArray_EMPTY(int nd, npy_intp* dims, int typenum, int fortran) + + Macro form of :cfunc:`PyArray_Empty` which takes a type-number, + *typenum*, instead of a data-type object. + +.. cfunction:: PyObject* PyArray_Arange(double start, double stop, double step, int typenum) + + Construct a new 1-dimensional array of data-type, *typenum*, that + ranges from *start* to *stop* (exclusive) in increments of *step* + . Equivalent to **arange** (*start*, *stop*, *step*, dtype). + +.. cfunction:: PyObject* PyArray_ArangeObj(PyObject* start, PyObject* stop, PyObject* step, PyArray_Descr* descr) + + Construct a new 1-dimensional array of data-type determined by + ``descr``, that ranges from ``start`` to ``stop`` (exclusive) in + increments of ``step``. Equivalent to arange( ``start``, + ``stop``, ``step``, ``typenum`` ). + + +From other objects +^^^^^^^^^^^^^^^^^^ + +.. cfunction:: PyObject* PyArray_FromAny(PyObject* op, PyArray_Descr* dtype, int min_depth, int max_depth, int requirements, PyObject* context) + + This is the main function used to obtain an array from any nested + sequence, or object that exposes the array interface, ``op``. The + parameters allow specification of the required *type*, the + minimum (*min_depth*) and maximum (*max_depth*) number of + dimensions acceptable, and other *requirements* for the array. The + *dtype* argument needs to be a :ctype:`PyArray_Descr` structure + indicating the desired data-type (including required + byteorder). The *dtype* argument may be NULL, indicating that any + data-type (and byteorder) is acceptable. If you want to use + ``NULL`` for the *dtype* and ensure the array is notswapped then + use :cfunc:`PyArray_CheckFromAny`. A value of 0 for either of the + depth parameters causes the parameter to be ignored. Any of the + following array flags can be added (*e.g.* using \|) to get the + *requirements* argument. If your code can handle general (*e.g.* + strided, byte-swapped, or unaligned arrays) then *requirements* + may be 0. Also, if *op* is not already an array (or does not + expose the array interface), then a new array will be created (and + filled from *op* using the sequence protocol). The new array will + have :cdata:`NPY_DEFAULT` as its flags member. The *context* argument + is passed to the :obj:`__array__` method of *op* and is only used if + the array is constructed that way. + + .. cvar:: NPY_C_CONTIGUOUS + + Make sure the returned array is C-style contiguous + + .. cvar:: NPY_F_CONTIGUOUS + + Make sure the returned array is Fortran-style contiguous. + + .. cvar:: NPY_ALIGNED + + Make sure the returned array is aligned on proper boundaries for its + data type. An aligned array has the data pointer and every strides + factor as a multiple of the alignment factor for the data-type- + descriptor. + + .. cvar:: NPY_WRITEABLE + + Make sure the returned array can be written to. + + .. cvar:: NPY_ENSURECOPY + + Make sure a copy is made of *op*. If this flag is not + present, data is not copied if it can be avoided. + + .. cvar:: NPY_ENSUREARRAY + + Make sure the result is a base-class ndarray or bigndarray. By + default, if *op* is an instance of a subclass of the + bigndarray, an instance of that same subclass is returned. If + this flag is set, an ndarray object will be returned instead. + + .. cvar:: NPY_FORCECAST + + Force a cast to the output type even if it cannot be done + safely. Without this flag, a data cast will occur only if it + can be done safely, otherwise an error is reaised. + + .. cvar:: NPY_UPDATEIFCOPY + + If *op* is already an array, but does not satisfy the + requirements, then a copy is made (which will satisfy the + requirements). If this flag is present and a copy (of an + object that is already an array) must be made, then the + corresponding :cdata:`NPY_UPDATEIFCOPY` flag is set in the returned + copy and *op* is made to be read-only. When the returned copy + is deleted (presumably after your calculations are complete), + its contents will be copied back into *op* and the *op* array + will be made writeable again. If *op* is not writeable to + begin with, then an error is raised. If *op* is not already an + array, then this flag has no effect. + + .. cvar:: NPY_BEHAVED + + :cdata:`NPY_ALIGNED` \| :cdata:`NPY_WRITEABLE` + + .. cvar:: NPY_CARRAY + + :cdata:`NPY_C_CONTIGUOUS` \| :cdata:`NPY_BEHAVED` + + .. cvar:: NPY_CARRAY_RO + + :cdata:`NPY_C_CONTIGUOUS` \| :cdata:`NPY_ALIGNED` + + .. cvar:: NPY_FARRAY + + :cdata:`NPY_F_CONTIGUOUS` \| :cdata:`NPY_BEHAVED` + + .. cvar:: NPY_FARRAY_RO + + :cdata:`NPY_F_CONTIGUOUS` \| :cdata:`NPY_ALIGNED` + + .. cvar:: NPY_DEFAULT + + :cdata:`NPY_CARRAY` + + .. cvar:: NPY_IN_ARRAY + + :cdata:`NPY_CONTIGUOUS` \| :cdata:`NPY_ALIGNED` + + .. cvar:: NPY_IN_FARRAY + + :cdata:`NPY_F_CONTIGUOUS` \| :cdata:`NPY_ALIGNED` + + .. cvar:: NPY_INOUT_ARRAY + + :cdata:`NPY_C_CONTIGUOUS` \| :cdata:`NPY_WRITEABLE` \| + :cdata:`NPY_ALIGNED` + + .. cvar:: NPY_INOUT_FARRAY + + :cdata:`NPY_F_CONTIGUOUS` \| :cdata:`NPY_WRITEABLE` \| + :cdata:`NPY_ALIGNED` + + .. cvar:: NPY_OUT_ARRAY + + :cdata:`NPY_C_CONTIGUOUS` \| :cdata:`NPY_WRITEABLE` \| + :cdata:`NPY_ALIGNED` \| :cdata:`NPY_UPDATEIFCOPY` + + .. cvar:: NPY_OUT_FARRAY + + :cdata:`NPY_F_CONTIGUOUS` \| :cdata:`NPY_WRITEABLE` \| + :cdata:`NPY_ALIGNED` \| :cdata:`UPDATEIFCOPY` + + +.. cfunction:: PyObject* PyArray_CheckFromAny(PyObject* op, PyArray_Descr* dtype, int min_depth, int max_depth, int requirements, PyObject* context) + + Nearly identical to :cfunc:`PyArray_FromAny` (...) except + *requirements* can contain :cdata:`NPY_NOTSWAPPED` (over-riding the + specification in *dtype*) and :cdata:`NPY_ELEMENTSTRIDES` which + indicates that the array should be aligned in the sense that the + strides are multiples of the element size. + +.. cvar:: NPY_NOTSWAPPED + + Make sure the returned array has a data-type descriptor that is in + machine byte-order, over-riding any specification in the *dtype* + argument. Normally, the byte-order requirement is determined by + the *dtype* argument. If this flag is set and the dtype argument + does not indicate a machine byte-order descriptor (or is NULL and + the object is already an array with a data-type descriptor that is + not in machine byte- order), then a new data-type descriptor is + created and used with its byte-order field set to native. + +.. cvar:: NPY_BEHAVED_NS + + :cdata:`NPY_ALIGNED` \| :cdata:`NPY_WRITEABLE` \| :cdata:`NPY_NOTSWAPPED` + +.. cvar:: NPY_ELEMENTSTRIDES + + Make sure the returned array has strides that are multiples of the + element size. + +.. cfunction:: PyObject* PyArray_FromArray(PyArrayObject* op, PyArray_Descr* newtype, int requirements) + + Special case of :cfunc:`PyArray_FromAny` for when *op* is already an + array but it needs to be of a specific *newtype* (including + byte-order) or has certain *requirements*. + +.. cfunction:: PyObject* PyArray_FromStructInterface(PyObject* op) + + Returns an ndarray object from a Python object that exposes the + :obj:`__array_struct__`` method and follows the array interface + protocol. If the object does not contain this method then a + borrowed reference to :cdata:`Py_NotImplemented` is returned. + +.. cfunction:: PyObject* PyArray_FromInterface(PyObject* op) + + Returns an ndarray object from a Python object that exposes the + :obj:`__array_shape__` and :obj:`__array_typestr__` + methods following + the array interface protocol. If the object does not contain one + of these method then a borrowed reference to :cdata:`Py_NotImplemented` + is returned. + +.. cfunction:: PyObject* PyArray_FromArrayAttr(PyObject* op, PyArray_Descr* dtype, PyObject* context) + + Return an ndarray object from a Python object that exposes the + :obj:`__array__` method. The :obj:`__array__` method can take 0, 1, or 2 + arguments ([dtype, context]) where *context* is used to pass + information about where the :obj:`__array__` method is being called + from (currently only used in ufuncs). + +.. cfunction:: PyObject* PyArray_ContiguousFromAny(PyObject* op, int typenum, int min_depth, int max_depth) + + This function returns a (C-style) contiguous and behaved function + array from any nested sequence or array interface exporting + object, *op*, of (non-flexible) type given by the enumerated + *typenum*, of minimum depth *min_depth*, and of maximum depth + *max_depth*. Equivalent to a call to :cfunc:`PyArray_FromAny` with + requirements set to :cdata:`NPY_DEFAULT` and the type_num member of the + type argument set to *typenum*. + +.. cfunction:: PyObject *PyArray_FromObject(PyObject *op, int typenum, int min_depth, int max_depth) + + Return an aligned and in native-byteorder array from any nested + sequence or array-interface exporting object, op, of a type given by + the enumerated typenum. The minimum number of dimensions the array can + have is given by min_depth while the maximum is max_depth. This is + equivalent to a call to :cfunc:`PyArray_FromAny` with requirements set to + BEHAVED. + +.. cfunction:: PyObject* PyArray_EnsureArray(PyObject* op) + + This function **steals a reference** to ``op`` and makes sure that + ``op`` is a base-class ndarray. It special cases array scalars, + but otherwise calls :cfunc:`PyArray_FromAny` ( ``op``, NULL, 0, 0, + :cdata:`NPY_ENSUREARRAY`). + +.. cfunction:: PyObject* PyArray_FromString(char* string, npy_intp slen, PyArray_Descr* dtype, npy_intp num, char* sep) + + Construct a one-dimensional ndarray of a single type from a binary + or (ASCII) text ``string`` of length ``slen``. The data-type of + the array to-be-created is given by ``dtype``. If num is -1, then + **copy** the entire string and return an appropriately sized + array, otherwise, ``num`` is the number of items to **copy** from + the string. If ``sep`` is NULL (or ""), then interpret the string + as bytes of binary data, otherwise convert the sub-strings + separated by ``sep`` to items of data-type ``dtype``. Some + data-types may not be readable in text mode and an error will be + raised if that occurs. All errors return NULL. + +.. cfunction:: PyObject* PyArray_FromFile(FILE* fp, PyArray_Descr* dtype, npy_intp num, char* sep) + + Construct a one-dimensional ndarray of a single type from a binary + or text file. The open file pointer is ``fp``, the data-type of + the array to be created is given by ``dtype``. This must match + the data in the file. If ``num`` is -1, then read until the end of + the file and return an appropriately sized array, otherwise, + ``num`` is the number of items to read. If ``sep`` is NULL (or + ""), then read from the file in binary mode, otherwise read from + the file in text mode with ``sep`` providing the item + separator. Some array types cannot be read in text mode in which + case an error is raised. + +.. cfunction:: PyObject* PyArray_FromBuffer(PyObject* buf, PyArray_Descr* dtype, npy_intp count, npy_intp offset) + + Construct a one-dimensional ndarray of a single type from an + object, ``buf``, that exports the (single-segment) buffer protocol + (or has an attribute __buffer\__ that returns an object that + exports the buffer protocol). A writeable buffer will be tried + first followed by a read- only buffer. The :cdata:`NPY_WRITEABLE` + flag of the returned array will reflect which one was + successful. The data is assumed to start at ``offset`` bytes from + the start of the memory location for the object. The type of the + data in the buffer will be interpreted depending on the data- type + descriptor, ``dtype.`` If ``count`` is negative then it will be + determined from the size of the buffer and the requested itemsize, + otherwise, ``count`` represents how many elements should be + converted from the buffer. + +.. cfunction:: int PyArray_CopyInto(PyArrayObject* dest, PyArrayObject* src) + + Copy from the source array, ``src``, into the destination array, + ``dest``, performing a data-type conversion if necessary. If an + error occurs return -1 (otherwise 0). The shape of ``src`` must be + broadcastable to the shape of ``dest``. The data areas of dest + and src must not overlap. + +.. cfunction:: int PyArray_MoveInto(PyArrayObject* dest, PyArrayObject* src) + + Move data from the source array, ``src``, into the destination + array, ``dest``, performing a data-type conversion if + necessary. If an error occurs return -1 (otherwise 0). The shape + of ``src`` must be broadcastable to the shape of ``dest``. The + data areas of dest and src may overlap. + +.. cfunction:: PyArrayObject* PyArray_GETCONTIGUOUS(PyObject* op) + + If ``op`` is already (C-style) contiguous and well-behaved then + just return a reference, otherwise return a (contiguous and + well-behaved) copy of the array. The parameter op must be a + (sub-class of an) ndarray and no checking for that is done. + +.. cfunction:: PyObject* PyArray_FROM_O(PyObject* obj) + + Convert ``obj`` to an ndarray. The argument can be any nested + sequence or object that exports the array interface. This is a + macro form of :cfunc:`PyArray_FromAny` using ``NULL``, 0, 0, 0 for the + other arguments. Your code must be able to handle any data-type + descriptor and any combination of data-flags to use this macro. + +.. cfunction:: PyObject* PyArray_FROM_OF(PyObject* obj, int requirements) + + Similar to :cfunc:`PyArray_FROM_O` except it can take an argument + of *requirements* indicating properties the resulting array must + have. Available requirements that can be enforced are + :cdata:`NPY_CONTIGUOUS`, :cdata:`NPY_F_CONTIGUOUS`, + :cdata:`NPY_ALIGNED`, :cdata:`NPY_WRITEABLE`, + :cdata:`NPY_NOTSWAPPED`, :cdata:`NPY_ENSURECOPY`, + :cdata:`NPY_UPDATEIFCOPY`, :cdata:`NPY_FORCECAST`, and + :cdata:`NPY_ENSUREARRAY`. Standard combinations of flags can also + be used: + +.. cfunction:: PyObject* PyArray_FROM_OT(PyObject* obj, int typenum) + + Similar to :cfunc:`PyArray_FROM_O` except it can take an argument of + *typenum* specifying the type-number the returned array. + +.. cfunction:: PyObject* PyArray_FROM_OTF(PyObject* obj, int typenum, int requirements) + + Combination of :cfunc:`PyArray_FROM_OF` and :cfunc:`PyArray_FROM_OT` + allowing both a *typenum* and a *flags* argument to be provided.. + +.. cfunction:: PyObject* PyArray_FROMANY(PyObject* obj, int typenum, int min, int max, int requirements) + + Similar to :cfunc:`PyArray_FromAny` except the data-type is + specified using a typenumber. :cfunc:`PyArray_DescrFromType` + (*typenum*) is passed directly to :cfunc:`PyArray_FromAny`. This + macro also adds :cdata:`NPY_DEFAULT` to requirements if + :cdata:`NPY_ENSURECOPY` is passed in as requirements. + +.. cfunction:: PyObject *PyArray_CheckAxis(PyObject* obj, int* axis, int requirements) + + Encapsulate the functionality of functions and methods that take + the axis= keyword and work properly with None as the axis + argument. The input array is ``obj``, while ``*axis`` is a + converted integer (so that >=MAXDIMS is the None value), and + ``requirements`` gives the needed properties of ``obj``. The + output is a converted version of the input so that requirements + are met and if needed a flattening has occurred. On output + negative values of ``*axis`` are converted and the new value is + checked to ensure consistency with the shape of ``obj``. + + +Dealing with types +------------------ + + +General check of Python Type +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. cfunction:: PyArray_Check(op) + + Evaluates true if *op* is a Python object whose type is a sub-type + of :cdata:`PyArray_Type`. + +.. cfunction:: PyArray_CheckExact(op) + + Evaluates true if *op* is a Python object with type + :cdata:`PyArray_Type`. + +.. cfunction:: PyArray_HasArrayInterface(op, out) + + If ``op`` implements any part of the array interface, then ``out`` + will contain a new reference to the newly created ndarray using + the interface or ``out`` will contain ``NULL`` if an error during + conversion occurs. Otherwise, out will contain a borrowed + reference to :cdata:`Py_NotImplemented` and no error condition is set. + +.. cfunction:: PyArray_HasArrayInterfaceType(op, type, context, out) + + If ``op`` implements any part of the array interface, then ``out`` + will contain a new reference to the newly created ndarray using + the interface or ``out`` will contain ``NULL`` if an error during + conversion occurs. Otherwise, out will contain a borrowed + reference to Py_NotImplemented and no error condition is set. + This version allows setting of the type and context in the part of + the array interface that looks for the :obj:`__array__` attribute. + +.. cfunction:: PyArray_IsZeroDim(op) + + Evaluates true if *op* is an instance of (a subclass of) + :cdata:`PyArray_Type` and has 0 dimensions. + +.. cfunction:: PyArray_IsScalar(op, cls) + + Evaluates true if *op* is an instance of :cdata:`Py{cls}ArrType_Type`. + +.. cfunction:: PyArray_CheckScalar(op) + + Evaluates true if *op* is either an array scalar (an instance of a + sub-type of :cdata:`PyGenericArr_Type` ), or an instance of (a + sub-class of) :cdata:`PyArray_Type` whose dimensionality is 0. + +.. cfunction:: PyArray_IsPythonScalar(op) + + Evaluates true if *op* is a builtin Python "scalar" object (int, + float, complex, str, unicode, long, bool). + +.. cfunction:: PyArray_IsAnyScalar(op) + + Evaluates true if *op* is either a Python scalar or an array + scalar (an instance of a sub- type of :cdata:`PyGenericArr_Type` ). + + +Data-type checking +^^^^^^^^^^^^^^^^^^ + +For the typenum macros, the argument is an integer representing an +enumerated array data type. For the array type checking macros the +argument must be a :ctype:`PyObject *` that can be directly interpreted as a +:ctype:`PyArrayObject *`. + +.. cfunction:: PyTypeNum_ISUNSIGNED(num) + +.. cfunction:: PyDataType_ISUNSIGNED(descr) + +.. cfunction:: PyArray_ISUNSIGNED(obj) + + Type represents an unsigned integer. + +.. cfunction:: PyTypeNum_ISSIGNED(num) + +.. cfunction:: PyDataType_ISSIGNED(descr) + +.. cfunction:: PyArray_ISSIGNED(obj) + + Type represents a signed integer. + +.. cfunction:: PyTypeNum_ISINTEGER(num) + +.. cfunction:: PyDataType_ISINTEGER(descr) + +.. cfunction:: PyArray_ISINTEGER(obj) + + Type represents any integer. + +.. cfunction:: PyTypeNum_ISFLOAT(num) + +.. cfunction:: PyDataType_ISFLOAT(descr) + +.. cfunction:: PyArray_ISFLOAT(obj) + + Type represents any floating point number. + +.. cfunction:: PyTypeNum_ISCOMPLEX(num) + +.. cfunction:: PyDataType_ISCOMPLEX(descr) + +.. cfunction:: PyArray_ISCOMPLEX(obj) + + Type represents any complex floating point number. + +.. cfunction:: PyTypeNum_ISNUMBER(num) + +.. cfunction:: PyDataType_ISNUMBER(descr) + +.. cfunction:: PyArray_ISNUMBER(obj) + + Type represents any integer, floating point, or complex floating point + number. + +.. cfunction:: PyTypeNum_ISSTRING(num) + +.. cfunction:: PyDataType_ISSTRING(descr) + +.. cfunction:: PyArray_ISSTRING(obj) + + Type represents a string data type. + +.. cfunction:: PyTypeNum_ISPYTHON(num) + +.. cfunction:: PyDataType_ISPYTHON(descr) + +.. cfunction:: PyArray_ISPYTHON(obj) + + Type represents an enumerated type corresponding to one of the + standard Python scalar (bool, int, float, or complex). + +.. cfunction:: PyTypeNum_ISFLEXIBLE(num) + +.. cfunction:: PyDataType_ISFLEXIBLE(descr) + +.. cfunction:: PyArray_ISFLEXIBLE(obj) + + Type represents one of the flexible array types ( :cdata:`NPY_STRING`, + :cdata:`NPY_UNICODE`, or :cdata:`NPY_VOID` ). + +.. cfunction:: PyTypeNum_ISUSERDEF(num) + +.. cfunction:: PyDataType_ISUSERDEF(descr) + +.. cfunction:: PyArray_ISUSERDEF(obj) + + Type represents a user-defined type. + +.. cfunction:: PyTypeNum_ISEXTENDED(num) + +.. cfunction:: PyDataType_ISEXTENDED(descr) + +.. cfunction:: PyArray_ISEXTENDED(obj) + + Type is either flexible or user-defined. + +.. cfunction:: PyTypeNum_ISOBJECT(num) + +.. cfunction:: PyDataType_ISOBJECT(descr) + +.. cfunction:: PyArray_ISOBJECT(obj) + + Type represents object data type. + +.. cfunction:: PyTypeNum_ISBOOL(num) + +.. cfunction:: PyDataType_ISBOOL(descr) + +.. cfunction:: PyArray_ISBOOL(obj) + + Type represents Boolean data type. + +.. cfunction:: PyDataType_HASFIELDS(descr) + +.. cfunction:: PyArray_HASFIELDS(obj) + + Type has fields associated with it. + +.. cfunction:: PyArray_ISNOTSWAPPED(m) + + Evaluates true if the data area of the ndarray *m* is in machine + byte-order according to the array's data-type descriptor. + +.. cfunction:: PyArray_ISBYTESWAPPED(m) + + Evaluates true if the data area of the ndarray *m* is **not** in + machine byte-order according to the array's data-type descriptor. + +.. cfunction:: Bool PyArray_EquivTypes(PyArray_Descr* type1, PyArray_Descr* type2) + + Return :cdata:`NPY_TRUE` if *type1* and *type2* actually represent + equivalent types for this platform (the fortran member of each + type is ignored). For example, on 32-bit platforms, + :cdata:`NPY_LONG` and :cdata:`NPY_INT` are equivalent. Otherwise + return :cdata:`NPY_FALSE`. + +.. cfunction:: Bool PyArray_EquivArrTypes(PyArrayObject* a1, PyArrayObject * a2) + + Return :cdata:`NPY_TRUE` if *a1* and *a2* are arrays with equivalent + types for this platform. + +.. cfunction:: Bool PyArray_EquivTypenums(int typenum1, int typenum2) + + Special case of :cfunc:`PyArray_EquivTypes` (...) that does not accept + flexible data types but may be easier to call. + +.. cfunction:: int PyArray_EquivByteorders({byteorder} b1, {byteorder} b2) + + True if byteorder characters ( :cdata:`NPY_LITTLE`, + :cdata:`NPY_BIG`, :cdata:`NPY_NATIVE`, :cdata:`NPY_IGNORE` ) are + either equal or equivalent as to their specification of a native + byte order. Thus, on a little-endian machine :cdata:`NPY_LITTLE` + and :cdata:`NPY_NATIVE` are equivalent where they are not + equivalent on a big-endian machine. + + +Converting data types +^^^^^^^^^^^^^^^^^^^^^ + +.. cfunction:: PyObject* PyArray_Cast(PyArrayObject* arr, int typenum) + + Mainly for backwards compatibility to the Numeric C-API and for + simple casts to non-flexible types. Return a new array object with + the elements of *arr* cast to the data-type *typenum* which must + be one of the enumerated types and not a flexible type. + +.. cfunction:: PyObject* PyArray_CastToType(PyArrayObject* arr, PyArray_Descr* type, int fortran) + + Return a new array of the *type* specified, casting the elements + of *arr* as appropriate. The fortran argument specifies the + ordering of the output array. + +.. cfunction:: int PyArray_CastTo(PyArrayObject* out, PyArrayObject* in) + + Cast the elements of the array *in* into the array *out*. The + output array should be writeable, have an integer-multiple of the + number of elements in the input array (more than one copy can be + placed in out), and have a data type that is one of the builtin + types. Returns 0 on success and -1 if an error occurs. + +.. cfunction:: PyArray_VectorUnaryFunc* PyArray_GetCastFunc(PyArray_Descr* from, int totype) + + Return the low-level casting function to cast from the given + descriptor to the builtin type number. If no casting function + exists return ``NULL`` and set an error. Using this function + instead of direct access to *from* ->f->cast will allow support of + any user-defined casting functions added to a descriptors casting + dictionary. + +.. cfunction:: int PyArray_CanCastSafely(int fromtype, int totype) + + Returns non-zero if an array of data type *fromtype* can be cast + to an array of data type *totype* without losing information. An + exception is that 64-bit integers are allowed to be cast to 64-bit + floating point values even though this can lose precision on large + integers so as not to proliferate the use of long doubles without + explict requests. Flexible array types are not checked according + to their lengths with this function. + +.. cfunction:: int PyArray_CanCastTo(PyArray_Descr* fromtype, PyArray_Descr* totype) + + Returns non-zero if an array of data type *fromtype* (which can + include flexible types) can be cast safely to an array of data + type *totype* (which can include flexible types). This is + basically a wrapper around :cfunc:`PyArray_CanCastSafely` with + additional support for size checking if *fromtype* and *totype* + are :cdata:`NPY_STRING` or :cdata:`NPY_UNICODE`. + +.. cfunction:: int PyArray_ObjectType(PyObject* op, int mintype) + + This function is useful for determining a common type that two or + more arrays can be converted to. It only works for non-flexible + array types as no itemsize information is passed. The *mintype* + argument represents the minimum type acceptable, and *op* + represents the object that will be converted to an array. The + return value is the enumerated typenumber that represents the + data-type that *op* should have. + +.. cfunction:: void PyArray_ArrayType(PyObject* op, PyArray_Descr* mintype, PyArray_Descr* outtype) + + This function works similarly to :cfunc:`PyArray_ObjectType` (...) + except it handles flexible arrays. The *mintype* argument can have + an itemsize member and the *outtype* argument will have an + itemsize member at least as big but perhaps bigger depending on + the object *op*. + +.. cfunction:: PyArrayObject** PyArray_ConvertToCommonType(PyObject* op, int* n) + + Convert a sequence of Python objects contained in *op* to an array + of ndarrays each having the same data type. The type is selected + based on the typenumber (larger type number is chosen over a + smaller one) ignoring objects that are only scalars. The length of + the sequence is returned in *n*, and an *n* -length array of + :ctype:`PyArrayObject` pointers is the return value (or ``NULL`` if an + error occurs). The returned array must be freed by the caller of + this routine (using :cfunc:`PyDataMem_FREE` ) and all the array objects + in it ``DECREF`` 'd or a memory-leak will occur. The example + template-code below shows a typically usage: + + .. code-block:: c + + mps = PyArray_ConvertToCommonType(obj, &n); + if (mps==NULL) return NULL; + {code} + + for (i=0; iitemsize that + holds the representation of 0 for that type. The returned pointer, + *ret*, **must be freed** using :cfunc:`PyDataMem_FREE` (ret) when it is + not needed anymore. + +.. cfunction:: char* PyArray_One(PyArrayObject* arr) + + A pointer to newly created memory of size *arr* ->itemsize that + holds the representation of 1 for that type. The returned pointer, + *ret*, **must be freed** using :cfunc:`PyDataMem_FREE` (ret) when it + is not needed anymore. + +.. cfunction:: int PyArray_ValidType(int typenum) + + Returns :cdata:`NPY_TRUE` if *typenum* represents a valid type-number + (builtin or user-defined or character code). Otherwise, this + function returns :cdata:`NPY_FALSE`. + + +New data types +^^^^^^^^^^^^^^ + +.. cfunction:: void PyArray_InitArrFuncs(PyArray_ArrFuncs* f) + + Initialize all function pointers and members to ``NULL``. + +.. cfunction:: int PyArray_RegisterDataType(PyArray_Descr* dtype) + + Register a data-type as a new user-defined data type for + arrays. The type must have most of its entries filled in. This is + not always checked and errors can produce segfaults. In + particular, the typeobj member of the ``dtype`` structure must be + filled with a Python type that has a fixed-size element-size that + corresponds to the elsize member of *dtype*. Also the ``f`` + member must have the required functions: nonzero, copyswap, + copyswapn, getitem, setitem, and cast (some of the cast functions + may be ``NULL`` if no support is desired). To avoid confusion, you + should choose a unique character typecode but this is not enforced + and not relied on internally. + + A user-defined type number is returned that uniquely identifies + the type. A pointer to the new structure can then be obtained from + :cfunc:`PyArray_DescrFromType` using the returned type number. A -1 is + returned if an error occurs. If this *dtype* has already been + registered (checked only by the address of the pointer), then + return the previously-assigned type-number. + +.. cfunction:: int PyArray_RegisterCastFunc(PyArray_Descr* descr, int totype, PyArray_VectorUnaryFunc* castfunc) + + Register a low-level casting function, *castfunc*, to convert + from the data-type, *descr*, to the given data-type number, + *totype*. Any old casting function is over-written. A ``0`` is + returned on success or a ``-1`` on failure. + +.. cfunction:: int PyArray_RegisterCanCast(PyArray_Descr* descr, int totype, PyArray_SCALARKIND scalar) + + Register the data-type number, *totype*, as castable from + data-type object, *descr*, of the given *scalar* kind. Use + *scalar* = :cdata:`NPY_NOSCALAR` to register that an array of data-type + *descr* can be cast safely to a data-type whose type_number is + *totype*. + + +Special functions for PyArray_OBJECT +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. cfunction:: int PyArray_INCREF(PyArrayObject* op) + + Used for an array, *op*, that contains any Python objects. It + increments the reference count of every object in the array + according to the data-type of *op*. A -1 is returned if an error + occurs, otherwise 0 is returned. + +.. cfunction:: void PyArray_Item_INCREF(char* ptr, PyArray_Descr* dtype) + + A function to INCREF all the objects at the location *ptr* + according to the data-type *dtype*. If *ptr* is the start of a + record with an object at any offset, then this will (recursively) + increment the reference count of all object-like items in the + record. + +.. cfunction:: int PyArray_XDECREF(PyArrayObject* op) + + Used for an array, *op*, that contains any Python objects. It + decrements the reference count of every object in the array + according to the data-type of *op*. Normal return value is 0. A + -1 is returned if an error occurs. + +.. cfunction:: void PyArray_Item_XDECREF(char* ptr, PyArray_Descr* dtype) + + A function to XDECREF all the object-like items at the loacation + *ptr* as recorded in the data-type, *dtype*. This works + recursively so that if ``dtype`` itself has fields with data-types + that contain object-like items, all the object-like fields will be + XDECREF ``'d``. + +.. cfunction:: void PyArray_FillObjectArray(PyArrayObject* arr, PyObject* obj) + + Fill a newly created array with a single value obj at all + locations in the structure with object data-types. No checking is + performed but *arr* must be of data-type :ctype:`PyArray_OBJECT` and be + single-segment and uninitialized (no previous objects in + position). Use :cfunc:`PyArray_DECREF` (*arr*) if you need to + decrement all the items in the object array prior to calling this + function. + + +Array flags +----------- + + +Basic Array Flags +^^^^^^^^^^^^^^^^^ + +An ndarray can have a data segment that is not a simple contiguous +chunk of well-behaved memory you can manipulate. It may not be aligned +with word boundaries (very important on some platforms). It might have +its data in a different byte-order than the machine recognizes. It +might not be writeable. It might be in Fortan-contiguous order. The +array flags are used to indicate what can be said about data +associated with an array. + +.. cvar:: NPY_C_CONTIGUOUS + + The data area is in C-style contiguous order (last index varies the + fastest). + +.. cvar:: NPY_F_CONTIGUOUS + + The data area is in Fortran-style contiguous order (first index varies + the fastest). + +.. cvar:: NPY_OWNDATA + + The data area is owned by this array. + +.. cvar:: NPY_ALIGNED + + The data area is aligned appropriately (for all strides). + +.. cvar:: NPY_WRITEABLE + + The data area can be written to. + + Notice that the above 3 flags are are defined so that a new, well- + behaved array has these flags defined as true. + +.. cvar:: NPY_UPDATEIFCOPY + + The data area represents a (well-behaved) copy whose information + should be transferred back to the original when this array is deleted. + + +Combinations of array flags +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. cvar:: NPY_BEHAVED + + :cdata:`NPY_ALIGNED` \| :cdata:`NPY_WRITEABLE` + +.. cvar:: NPY_CARRAY + + :cdata:`NPY_C_CONTIGUOUS` \| :cdata:`NPY_BEHAVED` + +.. cvar:: NPY_CARRAY_RO + + :cdata:`NPY_C_CONTIGUOUS` \| :cdata:`NPY_ALIGNED` + +.. cvar:: NPY_FARRAY + + :cdata:`NPY_F_CONTIGUOUS` \| :cdata:`NPY_BEHAVED` + +.. cvar:: NPY_FARRAY_RO + + :cdata:`NPY_F_CONTIGUOUS` \| :cdata:`NPY_ALIGNED` + +.. cvar:: NPY_DEFAULT + + :cdata:`NPY_CARRAY` + +.. cvar:: NPY_UPDATE_ALL + + :cdata:`NPY_C_CONTIGUOUS` \| :cdata:`NPY_F_CONTIGUOUS` \| :cdata:`NPY_ALIGNED` + + +Flag-like constants +^^^^^^^^^^^^^^^^^^^ + +These constants are used in :cfunc:`PyArray_FromAny` (and its macro forms) to +specify desired properties of the new array. + +.. cvar:: NPY_FORCECAST + + Cast to the desired type, even if it can't be done without losing + information. + +.. cvar:: NPY_ENSURECOPY + + Make sure the resulting array is a copy of the original. + +.. cvar:: NPY_ENSUREARRAY + + Make sure the resulting object is an actual ndarray (or bigndarray), + and not a sub-class. + +.. cvar:: NPY_NOTSWAPPED + + Only used in :cfunc:`PyArray_CheckFromAny` to over-ride the byteorder + of the data-type object passed in. + +.. cvar:: NPY_BEHAVED_NS + + :cdata:`NPY_ALIGNED` \| :cdata:`NPY_WRITEABLE` \| :cdata:`NPY_NOTSWAPPED` + + +Flag checking +^^^^^^^^^^^^^ + +For all of these macros *arr* must be an instance of a (subclass of) +:cdata:`PyArray_Type`, but no checking is done. + +.. cfunction:: PyArray_CHKFLAGS(arr, flags) + + The first parameter, arr, must be an ndarray or subclass. The + parameter, *flags*, should be an integer consisting of bitwise + combinations of the possible flags an array can have: + :cdata:`NPY_C_CONTIGUOUS`, :cdata:`NPY_F_CONTIGUOUS`, + :cdata:`NPY_OWNDATA`, :cdata:`NPY_ALIGNED`, + :cdata:`NPY_WRITEABLE`, :cdata:`NPY_UPDATEIFCOPY`. + +.. cfunction:: PyArray_ISCONTIGUOUS(arr) + + Evaluates true if *arr* is C-style contiguous. + +.. cfunction:: PyArray_ISFORTRAN(arr) + + Evaluates true if *arr* is Fortran-style contiguous. + +.. cfunction:: PyArray_ISWRITEABLE(arr) + + Evaluates true if the data area of *arr* can be written to + +.. cfunction:: PyArray_ISALIGNED(arr) + + Evaluates true if the data area of *arr* is properly aligned on + the machine. + +.. cfunction:: PyArray_ISBEHAVED(arr) + + Evalutes true if the data area of *arr* is aligned and writeable + and in machine byte-order according to its descriptor. + +.. cfunction:: PyArray_ISBEHAVED_RO(arr) + + Evaluates true if the data area of *arr* is aligned and in machine + byte-order. + +.. cfunction:: PyArray_ISCARRAY(arr) + + Evaluates true if the data area of *arr* is C-style contiguous, + and :cfunc:`PyArray_ISBEHAVED` (*arr*) is true. + +.. cfunction:: PyArray_ISFARRAY(arr) + + Evaluates true if the data area of *arr* is Fortran-style + contiguous and :cfunc:`PyArray_ISBEHAVED` (*arr*) is true. + +.. cfunction:: PyArray_ISCARRAY_RO(arr) + + Evaluates true if the data area of *arr* is C-style contiguous, + aligned, and in machine byte-order. + +.. cfunction:: PyArray_ISFARRAY_RO(arr) + + Evaluates true if the data area of *arr* is Fortran-style + contiguous, aligned, and in machine byte-order **.** + +.. cfunction:: PyArray_ISONESEGMENT(arr) + + Evaluates true if the data area of *arr* consists of a single + (C-style or Fortran-style) contiguous segment. + +.. cfunction:: void PyArray_UpdateFlags(PyArrayObject* arr, int flagmask) + + The :cdata:`NPY_C_CONTIGUOUS`, :cdata:`NPY_ALIGNED`, and + :cdata:`NPY_F_CONTIGUOUS` array flags can be "calculated" from the + array object itself. This routine updates one or more of these + flags of *arr* as specified in *flagmask* by performing the + required calculation. + + +.. warning:: + + It is important to keep the flags updated (using + :cfunc:`PyArray_UpdateFlags` can help) whenever a manipulation with an + array is performed that might cause them to change. Later + calculations in NumPy that rely on the state of these flags do not + repeat the calculation to update them. + + +Array method alternative API +---------------------------- + + +Conversion +^^^^^^^^^^ + +.. cfunction:: PyObject* PyArray_GetField(PyArrayObject* self, PyArray_Descr* dtype, int offset) + + Equivalent to :meth:`ndarray.getfield` (*self*, *dtype*, *offset*). Return + a new array of the given *dtype* using the data in the current + array at a specified *offset* in bytes. The *offset* plus the + itemsize of the new array type must be less than *self* + ->descr->elsize or an error is raised. The same shape and strides + as the original array are used. Therefore, this function has the + effect of returning a field from a record array. But, it can also + be used to select specific bytes or groups of bytes from any array + type. + +.. cfunction:: int PyArray_SetField(PyArrayObject* self, PyArray_Descr* dtype, int offset, PyObject* val) + + Equivalent to :meth:`ndarray.setfield` (*self*, *val*, *dtype*, *offset* + ). Set the field starting at *offset* in bytes and of the given + *dtype* to *val*. The *offset* plus *dtype* ->elsize must be less + than *self* ->descr->elsize or an error is raised. Otherwise, the + *val* argument is converted to an array and copied into the field + pointed to. If necessary, the elements of *val* are repeated to + fill the destination array, But, the number of elements in the + destination must be an integer multiple of the number of elements + in *val*. + +.. cfunction:: PyObject* PyArray_Byteswap(PyArrayObject* self, Bool inplace) + + Equivalent to :meth:`ndarray.byteswap` (*self*, *inplace*). Return an array + whose data area is byteswapped. If *inplace* is non-zero, then do + the byteswap inplace and return a reference to self. Otherwise, + create a byteswapped copy and leave self unchanged. + +.. cfunction:: PyObject* PyArray_NewCopy(PyArrayObject* old, NPY_ORDER order) + + Equivalent to :meth:`ndarray.copy` (*self*, *fortran*). Make a copy of the + *old* array. The returned array is always aligned and writeable + with data interpreted the same as the old array. If *order* is + :cdata:`NPY_CORDER`, then a C-style contiguous array is returned. If + *order* is :cdata:`NPY_FORTRANORDER`, then a Fortran-style contiguous + array is returned. If *order is* :cdata:`NPY_ANYORDER`, then the array + returned is Fortran-style contiguous only if the old one is; + otherwise, it is C-style contiguous. + +.. cfunction:: PyObject* PyArray_ToList(PyArrayObject* self) + + Equivalent to :meth:`ndarray.tolist` (*self*). Return a nested Python list + from *self*. + +.. cfunction:: PyObject* PyArray_ToString(PyArrayObject* self, NPY_ORDER order) + + Equivalent to :meth:`ndarray.tostring` (*self*, *order*). Return the bytes + of this array in a Python string. + +.. cfunction:: PyObject* PyArray_ToFile(PyArrayObject* self, FILE* fp, char* sep, char* format) + + Write the contents of *self* to the file pointer *fp* in C-style + contiguous fashion. Write the data as binary bytes if *sep* is the + string ""or ``NULL``. Otherwise, write the contents of *self* as + text using the *sep* string as the item separator. Each item will + be printed to the file. If the *format* string is not ``NULL`` or + "", then it is a Python print statement format string showing how + the items are to be written. + +.. cfunction:: int PyArray_Dump(PyObject* self, PyObject* file, int protocol) + + Pickle the object in *self* to the given *file* (either a string + or a Python file object). If *file* is a Python string it is + considered to be the name of a file which is then opened in binary + mode. The given *protocol* is used (if *protocol* is negative, or + the highest available is used). This is a simple wrapper around + cPickle.dump(*self*, *file*, *protocol*). + +.. cfunction:: PyObject* PyArray_Dumps(PyObject* self, int protocol) + + Pickle the object in *self* to a Python string and return it. Use + the Pickle *protocol* provided (or the highest available if + *protocol* is negative). + +.. cfunction:: int PyArray_FillWithScalar(PyArrayObject* arr, PyObject* obj) + + Fill the array, *arr*, with the given scalar object, *obj*. The + object is first converted to the data type of *arr*, and then + copied into every location. A -1 is returned if an error occurs, + otherwise 0 is returned. + +.. cfunction:: PyObject* PyArray_View(PyArrayObject* self, PyArray_Descr* dtype) + + Equivalent to :meth:`ndarray.view` (*self*, *dtype*). Return a new view of + the array *self* as possibly a different data-type, *dtype*. If + *dtype* is ``NULL``, then the returned array will have the same + data type as *self*. The new data-type must be consistent with + the size of *self*. Either the itemsizes must be identical, or + *self* must be single-segment and the total number of bytes must + be the same. In the latter case the dimensions of the returned + array will be altered in the last (or first for Fortran-style + contiguous arrays) dimension. The data area of the returned array + and self is exactly the same. + + +Shape Manipulation +^^^^^^^^^^^^^^^^^^ + +.. cfunction:: PyObject* PyArray_Newshape(PyArrayObject* self, PyArray_Dims* newshape) + + Result will be a new array (pointing to the same memory location + as *self* if possible), but having a shape given by *newshape* + . If the new shape is not compatible with the strides of *self*, + then a copy of the array with the new specified shape will be + returned. + +.. cfunction:: PyObject* PyArray_Reshape(PyArrayObject* self, PyObject* shape) + + Equivalent to :meth:`ndarray.reshape` (*self*, *shape*) where *shape* is a + sequence. Converts *shape* to a :ctype:`PyArray_Dims` structure and + calls :cfunc:`PyArray_Newshape` internally. + +.. cfunction:: PyObject* PyArray_Squeeze(PyArrayObject* self) + + Equivalent to :meth:`ndarray.squeeze` (*self*). Return a new view of *self* + with all of the dimensions of length 1 removed from the shape. + +.. warning:: + + matrix objects are always 2-dimensional. Therefore, + :cfunc:`PyArray_Squeeze` has no effect on arrays of matrix sub-class. + +.. cfunction:: PyObject* PyArray_SwapAxes(PyArrayObject* self, int a1, int a2) + + Equivalent to :meth:`ndarray.swapaxes` (*self*, *a1*, *a2*). The returned + array is a new view of the data in *self* with the given axes, + *a1* and *a2*, swapped. + +.. cfunction:: PyObject* PyArray_Resize(PyArrayObject* self, PyArray_Dims* newshape, int refcheck, NPY_ORDER fortran) + + Equivalent to :meth:`ndarray.resize` (*self*, *newshape*, refcheck + ``=`` *refcheck*, order= fortran ). This function only works on + single-segment arrays. It changes the shape of *self* inplace and + will reallocate the memory for *self* if *newshape* has a + different total number of elements then the old shape. If + reallocation is necessary, then *self* must own its data, have + *self* - ``>base==NULL``, have *self* - ``>weakrefs==NULL``, and + (unless refcheck is 0) not be referenced by any other array. A + reference to the new array is returned. The fortran argument can + be :cdata:`NPY_ANYORDER`, :cdata:`NPY_CORDER`, or + :cdata:`NPY_FORTRANORDER`. This argument is used if the number of + dimension is (or is being resized to be) greater than 2. It + currently has no effect. Eventually it could be used to determine + how the resize operation should view the data when constructing a + differently-dimensioned array. + +.. cfunction:: PyObject* PyArray_Transpose(PyArrayObject* self, PyArray_Dims* permute) + + Equivalent to :meth:`ndarray.transpose` (*self*, *permute*). Permute the + axes of the ndarray object *self* according to the data structure + *permute* and return the result. If *permute* is ``NULL``, then + the resulting array has its axes reversed. For example if *self* + has shape :math:`10\times20\times30`, and *permute* ``.ptr`` is + (0,2,1) the shape of the result is :math:`10\times30\times20.` If + *permute* is ``NULL``, the shape of the result is + :math:`30\times20\times10.` + +.. cfunction:: PyObject* PyArray_Flatten(PyArrayObject* self, NPY_ORDER order) + + Equivalent to :meth:`ndarray.flatten` (*self*, *order*). Return a 1-d copy + of the array. If *order* is :cdata:`NPY_FORTRANORDER` the elements are + scanned out in Fortran order (first-dimension varies the + fastest). If *order* is :cdata:`NPY_CORDER`, the elements of ``self`` + are scanned in C-order (last dimension varies the fastest). If + *order* :cdata:`NPY_ANYORDER`, then the result of + :cfunc:`PyArray_ISFORTRAN` (*self*) is used to determine which order + to flatten. + +.. cfunction:: PyObject* PyArray_Ravel(PyArrayObject* self, NPY_ORDER order) + + Equivalent to *self*.ravel(*order*). Same basic functionality + as :cfunc:`PyArray_Flatten` (*self*, *order*) except if *order* is 0 + and *self* is C-style contiguous, the shape is altered but no copy + is performed. + + +Item selection and manipulation +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. cfunction:: PyObject* PyArray_TakeFrom(PyArrayObject* self, PyObject* indices, int axis, PyArrayObject* ret, NPY_CLIPMODE clipmode) + + Equivalent to :meth:`ndarray.take` (*self*, *indices*, *axis*, *ret*, + *clipmode*) except *axis* =None in Python is obtained by setting + *axis* = :cdata:`NPY_MAXDIMS` in C. Extract the items from self + indicated by the integer-valued *indices* along the given *axis.* + The clipmode argument can be :cdata:`NPY_RAISE`, :cdata:`NPY_WRAP`, or + :cdata:`NPY_CLIP` to indicate what to do with out-of-bound indices. The + *ret* argument can specify an output array rather than having one + created internally. + +.. cfunction:: PyObject* PyArray_PutTo(PyArrayObject* self, PyObject* values, PyObject* indices, NPY_CLIPMODE clipmode) + + Equivalent to *self*.put(*values*, *indices*, *clipmode* + ). Put *values* into *self* at the corresponding (flattened) + *indices*. If *values* is too small it will be repeated as + necessary. + +.. cfunction:: PyObject* PyArray_PutMask(PyArrayObject* self, PyObject* values, PyObject* mask) + + Place the *values* in *self* wherever corresponding positions + (using a flattened context) in *mask* are true. The *mask* and + *self* arrays must have the same total number of elements. If + *values* is too small, it will be repeated as necessary. + +.. cfunction:: PyObject* PyArray_Repeat(PyArrayObject* self, PyObject* op, int axis) + + Equivalent to :meth:`ndarray.repeat` (*self*, *op*, *axis*). Copy the + elements of *self*, *op* times along the given *axis*. Either + *op* is a scalar integer or a sequence of length *self* + ->dimensions[ *axis* ] indicating how many times to repeat each + item along the axis. + +.. cfunction:: PyObject* PyArray_Choose(PyArrayObject* self, PyObject* op, PyArrayObject* ret, NPY_CLIPMODE clipmode) + + Equivalent to :meth:`ndarray.choose` (*self*, *op*, *ret*, *clipmode*). + Create a new array by selecting elements from the sequence of + arrays in *op* based on the integer values in *self*. The arrays + must all be broadcastable to the same shape and the entries in + *self* should be between 0 and len(*op*). The output is placed + in *ret* unless it is ``NULL`` in which case a new output is + created. The *clipmode* argument determines behavior for when + entries in *self* are not between 0 and len(*op*). + + .. cvar:: NPY_RAISE + + raise a ValueError; + + .. cvar:: NPY_WRAP + + wrap values < 0 by adding len(*op*) and values >=len(*op*) + by subtracting len(*op*) until they are in range; + + .. cvar:: NPY_CLIP + + all values are clipped to the region [0, len(*op*) ). + + +.. cfunction:: PyObject* PyArray_Sort(PyArrayObject* self, int axis) + + Equivalent to :meth:`ndarray.sort` (*self*, *axis*). Return an array with + the items of *self* sorted along *axis*. + +.. cfunction:: PyObject* PyArray_ArgSort(PyArrayObject* self, int axis) + + Equivalent to :meth:`ndarray.argsort` (*self*, *axis*). Return an array of + indices such that selection of these indices along the given + ``axis`` would return a sorted version of *self*. If *self* + ->descr is a data-type with fields defined, then + self->descr->names is used to determine the sort order. A + comparison where the first field is equal will use the second + field and so on. To alter the sort order of a record array, create + a new data-type with a different order of names and construct a + view of the array with that new data-type. + +.. cfunction:: PyObject* PyArray_LexSort(PyObject* sort_keys, int axis) + + Given a sequence of arrays (*sort_keys*) of the same shape, + return an array of indices (similar to :cfunc:`PyArray_ArgSort` (...)) + that would sort the arrays lexicographically. A lexicographic sort + specifies that when two keys are found to be equal, the order is + based on comparison of subsequent keys. A merge sort (which leaves + equal entries unmoved) is required to be defined for the + types. The sort is accomplished by sorting the indices first using + the first *sort_key* and then using the second *sort_key* and so + forth. This is equivalent to the lexsort(*sort_keys*, *axis*) + Python command. Because of the way the merge-sort works, be sure + to understand the order the *sort_keys* must be in (reversed from + the order you would use when comparing two elements). + + If these arrays are all collected in a record array, then + :cfunc:`PyArray_Sort` (...) can also be used to sort the array + directly. + +.. cfunction:: PyObject* PyArray_SearchSorted(PyArrayObject* self, PyObject* values) + + Equivalent to :meth:`ndarray.searchsorted` (*self*, *values*). Assuming + *self* is a 1-d array in ascending order representing bin + boundaries then the output is an array the same shape as *values* + of bin numbers, giving the bin into which each item in *values* + would be placed. No checking is done on whether or not self is in + ascending order. + +.. cfunction:: PyObject* PyArray_Diagonal(PyArrayObject* self, int offset, int axis1, int axis2) + + Equivalent to :meth:`ndarray.diagonal` (*self*, *offset*, *axis1*, *axis2* + ). Return the *offset* diagonals of the 2-d arrays defined by + *axis1* and *axis2*. + +.. cfunction:: PyObject* PyArray_Nonzero(PyArrayObject* self) + + Equivalent to :meth:`ndarray.nonzero` (*self*). Returns a tuple of index + arrays that select elements of *self* that are nonzero. If (nd= + :cfunc:`PyArray_NDIM` ( ``self`` ))==1, then a single index array is + returned. The index arrays have data type :cdata:`NPY_INTP`. If a + tuple is returned (nd :math:`\neq` 1), then its length is nd. + +.. cfunction:: PyObject* PyArray_Compress(PyArrayObject* self, PyObject* condition, int axis, PyArrayObject* out) + + Equivalent to :meth:`ndarray.compress` (*self*, *condition*, *axis* + ). Return the elements along *axis* corresponding to elements of + *condition* that are true. + + +Calculation +^^^^^^^^^^^ + +.. tip:: + + Pass in :cdata:`NPY_MAXDIMS` for axis in order to achieve the same + effect that is obtained by passing in *axis* = :const:`None` in Python + (treating the array as a 1-d array). + +.. cfunction:: PyObject* PyArray_ArgMax(PyArrayObject* self, int axis) + + Equivalent to :meth:`ndarray.argmax` (*self*, *axis*). Return the index of + the largest element of *self* along *axis*. + +.. cfunction:: PyObject* PyArray_ArgMin(PyArrayObject* self, int axis) + + Equivalent to :meth:`ndarray.argmin` (*self*, *axis*). Return the index of + the smallest element of *self* along *axis*. + +.. cfunction:: PyObject* PyArray_Max(PyArrayObject* self, int axis, PyArrayObject* out) + + Equivalent to :meth:`ndarray.max` (*self*, *axis*). Return the largest + element of *self* along the given *axis*. + +.. cfunction:: PyObject* PyArray_Min(PyArrayObject* self, int axis, PyArrayObject* out) + + Equivalent to :meth:`ndarray.min` (*self*, *axis*). Return the smallest + element of *self* along the given *axis*. + +.. cfunction:: PyObject* PyArray_Ptp(PyArrayObject* self, int axis, PyArrayObject* out) + + Equivalent to :meth:`ndarray.ptp` (*self*, *axis*). Return the difference + between the largest element of *self* along *axis* and the + smallest element of *self* along *axis*. + + + +.. note:: + + The rtype argument specifies the data-type the reduction should + take place over. This is important if the data-type of the array + is not "large" enough to handle the output. By default, all + integer data-types are made at least as large as :cdata:`NPY_LONG` + for the "add" and "multiply" ufuncs (which form the basis for + mean, sum, cumsum, prod, and cumprod functions). + +.. cfunction:: PyObject* PyArray_Mean(PyArrayObject* self, int axis, int rtype, PyArrayObject* out) + + Equivalent to :meth:`ndarray.mean` (*self*, *axis*, *rtype*). Returns the + mean of the elements along the given *axis*, using the enumerated + type *rtype* as the data type to sum in. Default sum behavior is + obtained using :cdata:`PyArray_NOTYPE` for *rtype*. + +.. cfunction:: PyObject* PyArray_Trace(PyArrayObject* self, int offset, int axis1, int axis2, int rtype, PyArrayObject* out) + + Equivalent to :meth:`ndarray.trace` (*self*, *offset*, *axis1*, *axis2*, + *rtype*). Return the sum (using *rtype* as the data type of + summation) over the *offset* diagonal elements of the 2-d arrays + defined by *axis1* and *axis2* variables. A positive offset + chooses diagonals above the main diagonal. A negative offset + selects diagonals below the main diagonal. + +.. cfunction:: PyObject* PyArray_Clip(PyArrayObject* self, PyObject* min, PyObject* max) + + Equivalent to :meth:`ndarray.clip` (*self*, *min*, *max*). Clip an array, + *self*, so that values larger than *max* are fixed to *max* and + values less than *min* are fixed to *min*. + +.. cfunction:: PyObject* PyArray_Conjugate(PyArrayObject* self) + + Equivalent to :meth:`ndarray.conjugate` (*self*). + Return the complex conjugate of *self*. If *self* is not of + complex data type, then return *self* with an reference. + +.. cfunction:: PyObject* PyArray_Round(PyArrayObject* self, int decimals, PyArrayObject* out) + + Equivalent to :meth:`ndarray.round` (*self*, *decimals*, *out*). Returns + the array with elements rounded to the nearest decimal place. The + decimal place is defined as the :math:`10^{-\textrm{decimals}}` + digit so that negative *decimals* cause rounding to the nearest 10's, 100's, etc. If out is ``NULL``, then the output array is created, otherwise the output is placed in *out* which must be the correct size and type. + +.. cfunction:: PyObject* PyArray_Std(PyArrayObject* self, int axis, int rtype, PyArrayObject* out) + + Equivalent to :meth:`ndarray.std` (*self*, *axis*, *rtype*). Return the + standard deviation using data along *axis* converted to data type + *rtype*. + +.. cfunction:: PyObject* PyArray_Sum(PyArrayObject* self, int axis, int rtype, PyArrayObject* out) + + Equivalent to :meth:`ndarray.sum` (*self*, *axis*, *rtype*). Return 1-d + vector sums of elements in *self* along *axis*. Perform the sum + after converting data to data type *rtype*. + +.. cfunction:: PyObject* PyArray_CumSum(PyArrayObject* self, int axis, int rtype, PyArrayObject* out) + + Equivalent to :meth:`ndarray.cumsum` (*self*, *axis*, *rtype*). Return + cumulative 1-d sums of elements in *self* along *axis*. Perform + the sum after converting data to data type *rtype*. + +.. cfunction:: PyObject* PyArray_Prod(PyArrayObject* self, int axis, int rtype, PyArrayObject* out) + + Equivalent to :meth:`ndarray.prod` (*self*, *axis*, *rtype*). Return 1-d + products of elements in *self* along *axis*. Perform the product + after converting data to data type *rtype*. + +.. cfunction:: PyObject* PyArray_CumProd(PyArrayObject* self, int axis, int rtype, PyArrayObject* out) + + Equivalent to :meth:`ndarray.cumprod` (*self*, *axis*, *rtype*). Return + 1-d cumulative products of elements in ``self`` along ``axis``. + Perform the product after converting data to data type ``rtype``. + +.. cfunction:: PyObject* PyArray_All(PyArrayObject* self, int axis, PyArrayObject* out) + + Equivalent to :meth:`ndarray.all` (*self*, *axis*). Return an array with + True elements for every 1-d sub-array of ``self`` defined by + ``axis`` in which all the elements are True. + +.. cfunction:: PyObject* PyArray_Any(PyArrayObject* self, int axis, PyArrayObject* out) + + Equivalent to :meth:`ndarray.any` (*self*, *axis*). Return an array with + True elements for every 1-d sub-array of *self* defined by *axis* + in which any of the elements are True. + +Functions +--------- + + +Array Functions +^^^^^^^^^^^^^^^ + +.. cfunction:: int PyArray_AsCArray(PyObject** op, void* ptr, npy_intp* dims, int nd, int typenum, int itemsize) + + Sometimes it is useful to access a multidimensional array as a + C-style multi-dimensional array so that algorithms can be + implemented using C's a[i][j][k] syntax. This routine returns a + pointer, *ptr*, that simulates this kind of C-style array, for + 1-, 2-, and 3-d ndarrays. + + :param op: + + The address to any Python object. This Python object will be replaced + with an equivalent well-behaved, C-style contiguous, ndarray of the + given data type specifice by the last two arguments. Be sure that + stealing a reference in this way to the input object is justified. + + :param ptr: + + The address to a (ctype* for 1-d, ctype** for 2-d or ctype*** for 3-d) + variable where ctype is the equivalent C-type for the data type. On + return, *ptr* will be addressable as a 1-d, 2-d, or 3-d array. + + :param dims: + + An output array that contains the shape of the array object. This + array gives boundaries on any looping that will take place. + + :param nd: + + The dimensionality of the array (1, 2, or 3). + + :param typenum: + + The expected data type of the array. + + :param itemsize: + + This argument is only needed when *typenum* represents a + flexible array. Otherwise it should be 0. + +.. note:: + + The simulation of a C-style array is not complete for 2-d and 3-d + arrays. For example, the simulated arrays of pointers cannot be passed + to subroutines expecting specific, statically-defined 2-d and 3-d + arrays. To pass to functions requiring those kind of inputs, you must + statically define the required array and copy data. + +.. cfunction:: int PyArray_Free(PyObject* op, void* ptr) + + Must be called with the same objects and memory locations returned + from :cfunc:`PyArray_AsCArray` (...). This function cleans up memory + that otherwise would get leaked. + +.. cfunction:: PyObject* PyArray_Concatenate(PyObject* obj, int axis) + + Join the sequence of objects in *obj* together along *axis* into a + single array. If the dimensions or types are not compatible an + error is raised. + +.. cfunction:: PyObject* PyArray_InnerProduct(PyObject* obj1, PyObject* obj2) + + Compute a product-sum over the last dimensions of *obj1* and + *obj2*. Neither array is conjugated. + +.. cfunction:: PyObject* PyArray_MatrixProduct(PyObject* obj1, PyObject* obj) + + Compute a product-sum over the last dimension of *obj1* and the + second-to-last dimension of *obj2*. For 2-d arrays this is a + matrix-product. Neither array is conjugated. + +.. cfunction:: PyObject* PyArray_CopyAndTranspose(PyObject \* op) + + A specialized copy and transpose function that works only for 2-d + arrays. The returned array is a transposed copy of *op*. + +.. cfunction:: PyObject* PyArray_Correlate(PyObject* op1, PyObject* op2, int mode) + + Compute the 1-d correlation of the 1-d arrays *op1* and *op2* + . The correlation is computed at each output point by multiplying + *op1* by a shifted version of *op2* and summing the result. As a + result of the shift, needed values outside of the defined range of + *op1* and *op2* are interpreted as zero. The mode determines how + many shifts to return: 0 - return only shifts that did not need to + assume zero- values; 1 - return an object that is the same size as + *op1*, 2 - return all possible shifts (any overlap at all is + accepted). + +.. cfunction:: PyObject* PyArray_Where(PyObject* condition, PyObject* x, PyObject* y) + + If both ``x`` and ``y`` are ``NULL``, then return + :cfunc:`PyArray_Nonzero` (*condition*). Otherwise, both *x* and *y* + must be given and the object returned is shaped like *condition* + and has elements of *x* and *y* where *condition* is respectively + True or False. + + +Other functions +^^^^^^^^^^^^^^^ + +.. cfunction:: Bool PyArray_CheckStrides(int elsize, int nd, npy_intp numbytes, npy_intp* dims, npy_intp* newstrides) + + Determine if *newstrides* is a strides array consistent with the + memory of an *nd* -dimensional array with shape ``dims`` and + element-size, *elsize*. The *newstrides* array is checked to see + if jumping by the provided number of bytes in each direction will + ever mean jumping more than *numbytes* which is the assumed size + of the available memory segment. If *numbytes* is 0, then an + equivalent *numbytes* is computed assuming *nd*, *dims*, and + *elsize* refer to a single-segment array. Return :cdata:`NPY_TRUE` if + *newstrides* is acceptable, otherwise return :cdata:`NPY_FALSE`. + +.. cfunction:: npy_intp PyArray_MultiplyList(npy_intp* seq, int n) + +.. cfunction:: int PyArray_MultiplyIntList(int* seq, int n) + + Both of these routines multiply an *n* -length array, *seq*, of + integers and return the result. No overflow checking is performed. + +.. cfunction:: int PyArray_CompareLists(npy_intp* l1, npy_intp* l2, int n) + + Given two *n* -length arrays of integers, *l1*, and *l2*, return + 1 if the lists are identical; otherwise, return 0. + + +Array Iterators +--------------- + +An array iterator is a simple way to access the elements of an +N-dimensional array quickly and efficiently. Section `2 +<#sec-array-iterator>`__ provides more description and examples of +this useful approach to looping over an array. + +.. cfunction:: PyObject* PyArray_IterNew(PyObject* arr) + + Return an array iterator object from the array, *arr*. This is + equivalent to *arr*. **flat**. The array iterator object makes + it easy to loop over an N-dimensional non-contiguous array in + C-style contiguous fashion. + +.. cfunction:: PyObject* PyArray_IterAllButAxis(PyObject* arr, int \*axis) + + Return an array iterator that will iterate over all axes but the + one provided in *\*axis*. The returned iterator cannot be used + with :cfunc:`PyArray_ITER_GOTO1D`. This iterator could be used to + write something similar to what ufuncs do wherein the loop over + the largest axis is done by a separate sub-routine. If *\*axis* is + negative then *\*axis* will be set to the axis having the smallest + stride and that axis will be used. + +.. cfunction:: PyObject *PyArray_BroadcastToShape(PyObject* arr, npy_intp *dimensions, int nd) + + Return an array iterator that is broadcast to iterate as an array + of the shape provided by *dimensions* and *nd*. + +.. cfunction:: int PyArrayIter_Check(PyObject* op) + + Evaluates true if *op* is an array iterator (or instance of a + subclass of the array iterator type). + +.. cfunction:: void PyArray_ITER_RESET(PyObject* iterator) + + Reset an *iterator* to the beginning of the array. + +.. cfunction:: void PyArray_ITER_NEXT(PyObject* iterator) + + Incremement the index and the dataptr members of the *iterator* to + point to the next element of the array. If the array is not + (C-style) contiguous, also increment the N-dimensional coordinates + array. + +.. cfunction:: void *PyArray_ITER_DATA(PyObject* iterator) + + A pointer to the current element of the array. + +.. cfunction:: void PyArray_ITER_GOTO(PyObject* iterator, npy_intp* destination) + + Set the *iterator* index, dataptr, and coordinates members to the + location in the array indicated by the N-dimensional c-array, + *destination*, which must have size at least *iterator* + ->nd_m1+1. + +.. cfunction:: PyArray_ITER_GOTO1D(PyObject* iterator, npy_intp index) + + Set the *iterator* index and dataptr to the location in the array + indicated by the integer *index* which points to an element in the + C-styled flattened array. + +.. cfunction:: int PyArray_ITER_NOTDONE(PyObject* iterator) + + Evaluates TRUE as long as the iterator has not looped through all of + the elements, otherwise it evaluates FALSE. + + +Broadcasting (multi-iterators) +------------------------------ + +.. cfunction:: PyObject* PyArray_MultiIterNew(int num, ...) + + A simplified interface to broadcasting. This function takes the + number of arrays to broadcast and then *num* extra ( :ctype:`PyObject *` + ) arguments. These arguments are converted to arrays and iterators + are created. :cfunc:`PyArray_Broadcast` is then called on the resulting + multi-iterator object. The resulting, broadcasted mult-iterator + object is then returned. A broadcasted operation can then be + performed using a single loop and using :cfunc:`PyArray_MultiIter_NEXT` + (..) + +.. cfunction:: void PyArray_MultiIter_RESET(PyObject* multi) + + Reset all the iterators to the beginning in a multi-iterator + object, *multi*. + +.. cfunction:: void PyArray_MultiIter_NEXT(PyObject* multi) + + Advance each iterator in a multi-iterator object, *multi*, to its + next (broadcasted) element. + +.. cfunction:: void *PyArray_MultiIter_DATA(PyObject* multi, int i) + + Return the data-pointer of the *i* :math:`^{\textrm{th}}` iterator + in a multi-iterator object. + +.. cfunction:: void PyArray_MultiIter_NEXTi(PyObject* multi, int i) + + Advance the pointer of only the *i* :math:`^{\textrm{th}}` iterator. + +.. cfunction:: void PyArray_MultiIter_GOTO(PyObject* multi, npy_intp* destination) + + Advance each iterator in a multi-iterator object, *multi*, to the + given :math:`N` -dimensional *destination* where :math:`N` is the + number of dimensions in the broadcasted array. + +.. cfunction:: void PyArray_MultiIter_GOTO1D(PyObject* multi, npy_intp index) + + Advance each iterator in a multi-iterator object, *multi*, to the + corresponding location of the *index* into the flattened + broadcasted array. + +.. cfunction:: int PyArray_MultiIter_NOTDONE(PyObject* multi) + + Evaluates TRUE as long as the multi-iterator has not looped + through all of the elements (of the broadcasted result), otherwise + it evaluates FALSE. + +.. cfunction:: int PyArray_Broadcast(PyArrayMultiIterObject* mit) + + This function encapsulates the broadcasting rules. The *mit* + container should already contain iterators for all the arrays that + need to be broadcast. On return, these iterators will be adjusted + so that iteration over each simultaneously will accomplish the + broadcasting. A negative number is returned if an error occurs. + +.. cfunction:: int PyArray_RemoveSmallest(PyArrayMultiIterObject* mit) + + This function takes a multi-iterator object that has been + previously "broadcasted," finds the dimension with the smallest + "sum of strides" in the broadcasted result and adapts all the + iterators so as not to iterate over that dimension (by effectively + making them of length-1 in that dimension). The corresponding + dimension is returned unless *mit* ->nd is 0, then -1 is + returned. This function is useful for constructing ufunc-like + routines that broadcast their inputs correctly and then call a + strided 1-d version of the routine as the inner-loop. This 1-d + version is usually optimized for speed and for this reason the + loop should be performed over the axis that won't require large + stride jumps. + + +Array Scalars +------------- + +.. cfunction:: PyObject* PyArray_Return(PyArrayObject* arr) + + This function checks to see if *arr* is a 0-dimensional array and, + if so, returns the appropriate array scalar. It should be used + whenever 0-dimensional arrays could be returned to Python. + +.. cfunction:: PyObject* PyArray_Scalar(void* data, PyArray_Descr* dtype, PyObject* itemsize) + + Return an array scalar object of the given enumerated *typenum* + and *itemsize* by **copying** from memory pointed to by *data* + . If *swap* is nonzero then this function will byteswap the data + if appropriate to the data-type because array scalars are always + in correct machine-byte order. + +.. cfunction:: PyObject* PyArray_ToScalar(void* data, PyArrayObject* arr) + + Return an array scalar object of the type and itemsize indicated + by the array object *arr* copied from the memory pointed to by + *data* and swapping if the data in *arr* is not in machine + byte-order. + +.. cfunction:: PyObject* PyArray_FromScalar(PyObject* scalar, PyArray_Descr* outcode) + + Return a 0-dimensional array of type determined by *outcode* from + *scalar* which should be an array-scalar object. If *outcode* is + NULL, then the type is determined from *scalar*. + +.. cfunction:: void PyArray_ScalarAsCtype(PyObject* scalar, void* ctypeptr) + + Return in *ctypeptr* a pointer to the actual value in an array + scalar. There is no error checking so *scalar* must be an + array-scalar object, and ctypeptr must have enough space to hold + the correct type. For flexible-sized types, a pointer to the data + is copied into the memory of *ctypeptr*, for all other types, the + actual data is copied into the address pointed to by *ctypeptr*. + +.. cfunction:: void PyArray_CastScalarToCtype(PyObject* scalar, void* ctypeptr, PyArray_Descr* outcode) + + Return the data (cast to the data type indicated by *outcode*) + from the array-scalar, *scalar*, into the memory pointed to by + *ctypeptr* (which must be large enough to handle the incoming + memory). + +.. cfunction:: PyObject* PyArray_TypeObjectFromType(int type) + + Returns a scalar type-object from a type-number, *type* + . Equivalent to :cfunc:`PyArray_DescrFromType` (*type*)->typeobj + except for reference counting and error-checking. Returns a new + reference to the typeobject on success or ``NULL`` on failure. + +.. cfunction:: NPY_SCALARKIND PyArray_ScalarKind(int typenum, PyArrayObject** arr) + + Return the kind of scalar represented by *typenum* and the array + in *\*arr* (if *arr* is not ``NULL`` ). The array is assumed to be + rank-0 and only used if *typenum* represents a signed integer. If + *arr* is not ``NULL`` and the first element is negative then + :cdata:`NPY_INTNEG_SCALAR` is returned, otherwise + :cdata:`NPY_INTPOS_SCALAR` is returned. The possible return values + are :cdata:`NPY_{kind}_SCALAR` where ``{kind}`` can be **INTPOS**, + **INTNEG**, **FLOAT**, **COMPLEX**, **BOOL**, or **OBJECT**. + :cdata:`NPY_NOSCALAR` is also an enumerated value + :ctype:`NPY_SCALARKIND` variables can take on. + +.. cfunction:: int PyArray_CanCoerceScalar(char thistype, char neededtype, NPY_SCALARKIND scalar) + + Implements the rules for scalar coercion. Scalars are only + silently coerced from thistype to neededtype if this function + returns nonzero. If scalar is :cdata:`NPY_NOSCALAR`, then this + function is equivalent to :cfunc:`PyArray_CanCastSafely`. The rule is + that scalars of the same KIND can be coerced into arrays of the + same KIND. This rule means that high-precision scalars will never + cause low-precision arrays of the same KIND to be upcast. + + +Data-type descriptors +--------------------- + + + +.. warning:: + + Data-type objects must be reference counted so be aware of the + action on the data-type reference of different C-API calls. The + standard rule is that when a data-type object is returned it is a + new reference. Functions that take :ctype:`PyArray_Descr *` objects and + return arrays steal references to the data-type their inputs + unless otherwise noted. Therefore, you must own a reference to any + data-type object used as input to such a function. + +.. cfunction:: int PyArrayDescr_Check(PyObject* obj) + + Evaluates as true if *obj* is a data-type object ( :ctype:`PyArray_Descr *` ). + +.. cfunction:: PyArray_Descr* PyArray_DescrNew(PyArray_Descr* obj) + + Return a new data-type object copied from *obj* (the fields + reference is just updated so that the new object points to the + same fields dictionary if any). + +.. cfunction:: PyArray_Descr* PyArray_DescrNewFromType(int typenum) + + Create a new data-type object from the built-in (or + user-registered) data-type indicated by *typenum*. All builtin + types should not have any of their fields changed. This creates a + new copy of the :ctype:`PyArray_Descr` structure so that you can fill + it in as appropriate. This function is especially needed for + flexible data-types which need to have a new elsize member in + order to be meaningful in array construction. + +.. cfunction:: PyArray_Descr* PyArray_DescrNewByteorder(PyArray_Descr* obj, char newendian) + + Create a new data-type object with the byteorder set according to + *newendian*. All referenced data-type objects (in subdescr and + fields members of the data-type object) are also changed + (recursively). If a byteorder of :cdata:`NPY_IGNORE` is encountered it + is left alone. If newendian is :cdata:`NPY_SWAP`, then all byte-orders + are swapped. Other valid newendian values are :cdata:`NPY_NATIVE`, + :cdata:`NPY_LITTLE`, and :cdata:`NPY_BIG` which all cause the returned + data-typed descriptor (and all it's + referenced data-type descriptors) to have the corresponding byte- + order. + +.. cfunction:: PyArray_Descr* PyArray_DescrFromObject(PyObject* op, PyArray_Descr* mintype) + + Determine an appropriate data-type object from the object *op* + (which should be a "nested" sequence object) and the minimum + data-type descriptor mintype (which can be ``NULL`` ). Similar in + behavior to array(*op*).dtype. Don't confuse this function with + :cfunc:`PyArray_DescrConverter`. This function essentially looks at + all the objects in the (nested) sequence and determines the + data-type from the elements it finds. + +.. cfunction:: PyArray_Descr* PyArray_DescrFromScalar(PyObject* scalar) + + Return a data-type object from an array-scalar object. No checking + is done to be sure that *scalar* is an array scalar. If no + suitable data-type can be determined, then a data-type of + :cdata:`NPY_OBJECT` is returned by default. + +.. cfunction:: PyArray_Descr* PyArray_DescrFromType(int typenum) + + Returns a data-type object corresponding to *typenum*. The + *typenum* can be one of the enumerated types, a character code for + one of the enumerated types, or a user-defined type. + +.. cfunction:: int PyArray_DescrConverter(PyObject* obj, PyArray_Descr** dtype) + + Convert any compatible Python object, *obj*, to a data-type object + in *dtype*. A large number of Python objects can be converted to + data-type objects. See :ref:`arrays.dtypes` for a complete + description. This version of the converter converts None objects + to a :cdata:`NPY_DEFAULT_TYPE` data-type object. This function can + be used with the "O&" character code in :cfunc:`PyArg_ParseTuple` + processing. + +.. cfunction:: int PyArray_DescrConverter2(PyObject* obj, PyArray_Descr** dtype) + + Convert any compatible Python object, *obj*, to a data-type + object in *dtype*. This version of the converter converts None + objects so that the returned data-type is ``NULL``. This function + can also be used with the "O&" character in PyArg_ParseTuple + processing. + +.. cfunction:: int Pyarray_DescrAlignConverter(PyObject* obj, PyArray_Descr** dtype) + + Like :cfunc:`PyArray_DescrConverter` except it aligns C-struct-like + objects on word-boundaries as the compiler would. + +.. cfunction:: int Pyarray_DescrAlignConverter2(PyObject* obj, PyArray_Descr** dtype) + + Like :cfunc:`PyArray_DescrConverter2` except it aligns C-struct-like + objects on word-boundaries as the compiler would. + +.. cfunction:: PyObject *PyArray_FieldNames(PyObject* dict) + + Take the fields dictionary, *dict*, such as the one attached to a + data-type object and construct an ordered-list of field names such + as is stored in the names field of the :ctype:`PyArray_Descr` object. + + +Conversion Utilities +-------------------- + + +For use with :cfunc:`PyArg_ParseTuple` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +All of these functions can be used in :cfunc:`PyArg_ParseTuple` (...) with +the "O&" format specifier to automatically convert any Python object +to the required C-object. All of these functions return +:cdata:`NPY_SUCCEED` if successful and :cdata:`NPY_FAIL` if not. The first +argument to all of these function is a Python object. The second +argument is the **address** of the C-type to convert the Python object +to. + + +.. warning:: + + Be sure to understand what steps you should take to manage the + memory when using these conversion functions. These functions can + require freeing memory, and/or altering the reference counts of + specific objects based on your use. + +.. cfunction:: int PyArray_Converter(PyObject* obj, PyObject** address) + + Convert any Python object to a :ctype:`PyArrayObject`. If + :cfunc:`PyArray_Check` (*obj*) is TRUE then its reference count is + incremented and a reference placed in *address*. If *obj* is not + an array, then convert it to an array using :cfunc:`PyArray_FromAny` + . No matter what is returned, you must DECREF the object returned + by this routine in *address* when you are done with it. + +.. cfunction:: int PyArray_OutputConverter(PyObject* obj, PyArrayObject** address) + + This is a default converter for output arrays given to + functions. If *obj* is :cdata:`Py_None` or ``NULL``, then *\*address* + will be ``NULL`` but the call will succeed. If :cfunc:`PyArray_Check` ( + *obj*) is TRUE then it is returned in *\*address* without + incrementing its reference count. + +.. cfunction:: int PyArray_IntpConverter(PyObject* obj, PyArray_Dims* seq) + + Convert any Python sequence, *obj*, smaller than :cdata:`NPY_MAXDIMS` + to a C-array of :ctype:`npy_intp`. The Python object could also be a + single number. The *seq* variable is a pointer to a structure with + members ptr and len. On successful return, *seq* ->ptr contains a + pointer to memory that must be freed to avoid a memory leak. The + restriction on memory size allows this converter to be + conveniently used for sequences intended to be interpreted as + array shapes. + +.. cfunction:: int PyArray_BufferConverter(PyObject* obj, PyArray_Chunk* buf) + + Convert any Python object, *obj*, with a (single-segment) buffer + interface to a variable with members that detail the object's use + of its chunk of memory. The *buf* variable is a pointer to a + structure with base, ptr, len, and flags members. The + :ctype:`PyArray_Chunk` structure is binary compatibile with the + Python's buffer object (through its len member on 32-bit platforms + and its ptr member on 64-bit platforms or in Python 2.5). On + return, the base member is set to *obj* (or its base if *obj* is + already a buffer object pointing to another object). If you need + to hold on to the memory be sure to INCREF the base member. The + chunk of memory is pointed to by *buf* ->ptr member and has length + *buf* ->len. The flags member of *buf* is :cdata:`NPY_BEHAVED_RO` with + the :cdata:`NPY_WRITEABLE` flag set if *obj* has a writeable buffer + interface. + +.. cfunction:: int PyArray_AxisConverter(PyObject \* obj, int* axis) + + Convert a Python object, *obj*, representing an axis argument to + the proper value for passing to the functions that take an integer + axis. Specifically, if *obj* is None, *axis* is set to + :cdata:`NPY_MAXDIMS` which is interpreted correctly by the C-API + functions that take axis arguments. + +.. cfunction:: int PyArray_BoolConverter(PyObject* obj, Bool* value) + + Convert any Python object, *obj*, to :cdata:`NPY_TRUE` or + :cdata:`NPY_FALSE`, and place the result in *value*. + +.. cfunction:: int PyArray_ByteorderConverter(PyObject* obj, char* endian) + + Convert Python strings into the corresponding byte-order + character: + '>', '<', 's', '=', or '\|'. + +.. cfunction:: int PyArray_SortkindConverter(PyObject* obj, NPY_SORTKIND* sort) + + Convert Python strings into one of :cdata:`NPY_QUICKSORT` (starts + with 'q' or 'Q') , :cdata:`NPY_HEAPSORT` (starts with 'h' or 'H'), + or :cdata:`NPY_MERGESORT` (starts with 'm' or 'M'). + +.. cfunction:: int PyArray_SearchsideConverter(PyObject* obj, NPY_SEARCHSIDE* side) + + Convert Python strings into one of :cdata:`NPY_SEARCHLEFT` (starts with 'l' + or 'L'), or :cdata:`NPY_SEARCHRIGHT` (starts with 'r' or 'R'). + +Other conversions +^^^^^^^^^^^^^^^^^ + +.. cfunction:: int PyArray_PyIntAsInt(PyObject* op) + + Convert all kinds of Python objects (including arrays and array + scalars) to a standard integer. On error, -1 is returned and an + exception set. You may find useful the macro: + + .. code-block:: c + + #define error_converting(x) (((x) == -1) && PyErr_Occurred() + +.. cfunction:: npy_intp PyArray_PyIntAsIntp(PyObject* op) + + Convert all kinds of Python objects (including arrays and array + scalars) to a (platform-pointer-sized) integer. On error, -1 is + returned and an exception set. + +.. cfunction:: int PyArray_IntpFromSequence(PyObject* seq, npy_intp* vals, int maxvals) + + Convert any Python sequence (or single Python number) passed in as + *seq* to (up to) *maxvals* pointer-sized integers and place them + in the *vals* array. The sequence can be smaller then *maxvals* as + the number of converted objects is returned. + +.. cfunction:: int PyArray_TypestrConvert(int itemsize, int gentype) + + Convert typestring characters (with *itemsize*) to basic + enumerated data types. The typestring character corresponding to + signed and unsigned integers, floating point numbers, and + complex-floating point numbers are recognized and converted. Other + values of gentype are returned. This function can be used to + convert, for example, the string'f4' to :cdata:`NPY_FLOAT32`. + + +Miscellaneous +------------- + + +Importing the API +^^^^^^^^^^^^^^^^^ + +In order to make use of the C-API from another extension module, the +``import_array`` () command must be used. If the extension module is +self-contained in a single .c file, then that is all that needs to be +done. If, however, the extension module involves multiple files where +the C-API is needed then some additional steps must be taken. + +.. cfunction:: void import_array(void) + + This function must be called in the initialization section of a + module that will make use of the C-API. It imports the module + where the function-pointer table is stored and points the correct + variable to it. + +.. cmacro:: PY_ARRAY_UNIQUE_SYMBOL + +.. cmacro:: NO_IMPORT_ARRAY + + Using these #defines you can use the C-API in multiple files for a + single extension module. In each file you must define + :cmacro:`PY_ARRAY_UNIQUE_SYMBOL` to some name that will hold the + C-API (*e.g.* myextension_ARRAY_API). This must be done **before** + including the numpy/arrayobject.h file. In the module + intialization routine you call ``import_array`` (). In addition, + in the files that do not have the module initialization + sub_routine define :cmacro:`NO_IMPORT_ARRAY` prior to including + numpy/arrayobject.h. + + Suppose I have two files coolmodule.c and coolhelper.c which need + to be compiled and linked into a single extension module. Suppose + coolmodule.c contains the required initcool module initialization + function (with the import_array() function called). Then, + coolmodule.c would have at the top: + + .. code-block:: c + + #define PY_ARRAY_UNIQUE_SYMBOL cool_ARRAY_API + #include numpy/arrayobject.h + + On the other hand, coolhelper.c would contain at the top: + + .. code-block:: c + + #define PY_ARRAY_UNIQUE_SYMBOL cool_ARRAY_API + #define NO_IMPORT_ARRAY + #include numpy/arrayobject.h + +.. cfunction:: unsigned int PyArray_GetNDArrayCVersion(void) + + This just returns the value :cdata:`NPY_VERSION`. Because it is in the + C-API, however, comparing the output of this function from the + value defined in the current header gives a way to test if the + C-API has changed thus requiring a re-compilation of extension + modules that use the C-API. + + +Internal Flexibility +^^^^^^^^^^^^^^^^^^^^ + +.. cfunction:: int PyArray_SetNumericOps(PyObject* dict) + + NumPy stores an internal table of Python callable objects that are + used to implement arithmetic operations for arrays as well as + certain array calculation methods. This function allows the user + to replace any or all of these Python objects with their own + versions. The keys of the dictionary, *dict*, are the named + functions to replace and the paired value is the Python callable + object to use. Care should be taken that the function used to + replace an internal array operation does not itself call back to + that internal array operation (unless you have designed the + function to handle that), or an unchecked infinite recursion can + result (possibly causing program crash). The key names that + represent operations that can be replaced are: + + **add**, **subtract**, **multiply**, **divide**, + **remainder**, **power**, **square**, **reciprocal**, + **ones_like**, **sqrt**, **negative**, **absolute**, + **invert**, **left_shift**, **right_shift**, + **bitwise_and**, **bitwise_xor**, **bitwise_or**, + **less**, **less_equal**, **equal**, **not_equal**, + **greater**, **greater_equal**, **floor_divide**, + **true_divide**, **logical_or**, **logical_and**, + **floor**, **ceil**, **maximum**, **minimum**, **rint**. + + + These functions are included here because they are used at least once + in the array object's methods. The function returns -1 (without + setting a Python Error) if one of the objects being assigned is not + callable. + +.. cfunction:: PyObject* PyArray_GetNumericOps(void) + + Return a Python dictionary containing the callable Python objects + stored in the the internal arithmetic operation table. The keys of + this dictionary are given in the explanation for :cfunc:`PyArray_SetNumericOps`. + +.. cfunction:: void PyArray_SetStringFunction(PyObject* op, int repr) + + This function allows you to alter the tp_str and tp_repr methods + of the array object to any Python function. Thus you can alter + what happens for all arrays when str(arr) or repr(arr) is called + from Python. The function to be called is passed in as *op*. If + *repr* is non-zero, then this function will be called in response + to repr(arr), otherwise the function will be called in response to + str(arr). No check on whether or not *op* is callable is + performed. The callable passed in to *op* should expect an array + argument and should return a string to be printed. + + +Memory management +^^^^^^^^^^^^^^^^^ + +.. cfunction:: char* PyDataMem_NEW(size_t nbytes) + +.. cfunction:: PyDataMem_FREE(char* ptr) + +.. cfunction:: char* PyDataMem_RENEW(void * ptr, size_t newbytes) + + Macros to allocate, free, and reallocate memory. These macros are used + internally to create arrays. + +.. cfunction:: npy_intp* PyDimMem_NEW(nd) + +.. cfunction:: PyDimMem_FREE(npy_intp* ptr) + +.. cfunction:: npy_intp* PyDimMem_RENEW(npy_intp* ptr, npy_intp newnd) + + Macros to allocate, free, and reallocate dimension and strides memory. + +.. cfunction:: PyArray_malloc(nbytes) + +.. cfunction:: PyArray_free(ptr) + +.. cfunction:: PyArray_realloc(ptr, nbytes) + + These macros use different memory allocators, depending on the + constant :cdata:`NPY_USE_PYMEM`. The system malloc is used when + :cdata:`NPY_USE_PYMEM` is 0, if :cdata:`NPY_USE_PYMEM` is 1, then + the Python memory allocator is used. + + +Threading support +^^^^^^^^^^^^^^^^^ + +These macros are only meaningful if :cdata:`NPY_ALLOW_THREADS` +evaluates True during compilation of the extension module. Otherwise, +these macros are equivalent to whitespace. Python uses a single Global +Interpreter Lock (GIL) for each Python process so that only a single +thread may excecute at a time (even on multi-cpu machines). When +calling out to a compiled function that may take time to compute (and +does not have side-effects for other threads like updated global +variables), the GIL should be released so that other Python threads +can run while the time-consuming calculations are performed. This can +be accomplished using two groups of macros. Typically, if one macro in +a group is used in a code block, all of them must be used in the same +code block. Currently, :cdata:`NPY_ALLOW_THREADS` is defined to the +python-defined :cdata:`WITH_THREADS` constant unless the environment +variable :cdata:`NPY_NOSMP` is set in which case +:cdata:`NPY_ALLOW_THREADS` is defined to be 0. + +Group 1 +""""""" + + This group is used to call code that may take some time but does not + use any Python C-API calls. Thus, the GIL should be released during + its calculation. + + .. cmacro:: NPY_BEGIN_ALLOW_THREADS + + Equivalent to :cmacro:`Py_BEGIN_ALLOW_THREADS` except it uses + :cdata:`NPY_ALLOW_THREADS` to determine if the macro if + replaced with white-space or not. + + .. cmacro:: NPY_END_ALLOW_THREADS + + Equivalent to :cmacro:`Py_END_ALLOW_THREADS` except it uses + :cdata:`NPY_ALLOW_THREADS` to determine if the macro if + replaced with white-space or not. + + .. cmacro:: NPY_BEGIN_THREADS_DEF + + Place in the variable declaration area. This macro sets up the + variable needed for storing the Python state. + + .. cmacro:: NPY_BEGIN_THREADS + + Place right before code that does not need the Python + interpreter (no Python C-API calls). This macro saves the + Python state and releases the GIL. + + .. cmacro:: NPY_END_THREADS + + Place right after code that does not need the Python + interpreter. This macro acquires the GIL and restores the + Python state from the saved variable. + + .. cfunction:: NPY_BEGIN_THREADS_DESCR(PyArray_Descr *dtype) + + Useful to release the GIL only if *dtype* does not contain + arbitrary Python objects which may need the Python interpreter + during execution of the loop. Equivalent to + + .. cfunction:: NPY_END_THREADS_DESCR(PyArray_Descr *dtype) + + Useful to regain the GIL in situations where it was released + using the BEGIN form of this macro. + +Group 2 +""""""" + + This group is used to re-acquire the Python GIL after it has been + released. For example, suppose the GIL has been released (using the + previous calls), and then some path in the code (perhaps in a + different subroutine) requires use of the Python C-API, then these + macros are useful to acquire the GIL. These macros accomplish + essentially a reverse of the previous three (acquire the LOCK saving + what state it had) and then re-release it with the saved state. + + .. cmacro:: NPY_ALLOW_C_API_DEF + + Place in the variable declaration area to set up the necessary + variable. + + .. cmacro:: NPY_ALLOW_C_API + + Place before code that needs to call the Python C-API (when it is + known that the GIL has already been released). + + .. cmacro:: NPY_DISABLE_C_API + + Place after code that needs to call the Python C-API (to re-release + the GIL). + +.. tip:: + + Never use semicolons after the threading support macros. + + +Priority +^^^^^^^^ + +.. cvar:: NPY_PRIOIRTY + + Default priority for arrays. + +.. cvar:: NPY_SUBTYPE_PRIORITY + + Default subtype priority. + +.. cvar:: NPY_SCALAR_PRIORITY + + Default scalar priority (very small) + +.. cfunction:: double PyArray_GetPriority(PyObject* obj, double def) + + Return the :obj:`__array_priority__` attribute (converted to a + double) of *obj* or *def* if no attribute of that name + exists. Fast returns that avoid the attribute lookup are provided + for objects of type :cdata:`PyArray_Type`. + + +Default buffers +^^^^^^^^^^^^^^^ + +.. cvar:: NPY_BUFSIZE + + Default size of the user-settable internal buffers. + +.. cvar:: NPY_MIN_BUFSIZE + + Smallest size of user-settable internal buffers. + +.. cvar:: NPY_MAX_BUFSIZE + + Largest size allowed for the user-settable buffers. + + +Other constants +^^^^^^^^^^^^^^^ + +.. cvar:: NPY_NUM_FLOATTYPE + + The number of floating-point types + +.. cvar:: NPY_MAXDIMS + + The maximum number of dimensions allowed in arrays. + +.. cvar:: NPY_VERSION + + The current version of the ndarray object (check to see if this + variable is defined to guarantee the numpy/arrayobject.h header is + being used). + +.. cvar:: NPY_FALSE + + Defined as 0 for use with Bool. + +.. cvar:: NPY_TRUE + + Defined as 1 for use with Bool. + +.. cvar:: NPY_FAIL + + The return value of failed converter functions which are called using + the "O&" syntax in :cfunc:`PyArg_ParseTuple`-like functions. + +.. cvar:: NPY_SUCCEED + + The return value of successful converter functions which are called + using the "O&" syntax in :cfunc:`PyArg_ParseTuple`-like functions. + + +Miscellaneous Macros +^^^^^^^^^^^^^^^^^^^^ + +.. cfunction:: PyArray_SAMESHAPE(a1, a2) + + Evaluates as True if arrays *a1* and *a2* have the same shape. + +.. cfunction:: PyArray_MAX(a,b) + + Returns the maximum of *a* and *b*. If (*a*) or (*b*) are + expressions they are evaluated twice. + +.. cfunction:: PyArray_MIN(a,b) + + Returns the minimum of *a* and *b*. If (*a*) or (*b*) are + expressions they are evaluated twice. + +.. cfunction:: PyArray_CLT(a,b) + +.. cfunction:: PyArray_CGT(a,b) + +.. cfunction:: PyArray_CLE(a,b) + +.. cfunction:: PyArray_CGE(a,b) + +.. cfunction:: PyArray_CEQ(a,b) + +.. cfunction:: PyArray_CNE(a,b) + + Implements the complex comparisons between two complex numbers + (structures with a real and imag member) using NumPy's definition + of the ordering which is lexicographic: comparing the real parts + first and then the complex parts if the real parts are equal. + +.. cfunction:: PyArray_REFCOUNT(PyObject* op) + + Returns the reference count of any Python object. + +.. cfunction:: PyArray_XDECREF_ERR(PyObject \*obj) + + DECREF's an array object which may have the :cdata:`NPY_UPDATEIFCOPY` + flag set without causing the contents to be copied back into the + original array. Resets the :cdata:`NPY_WRITEABLE` flag on the base + object. This is useful for recovering from an error condition when + :cdata:`NPY_UPDATEIFCOPY` is used. + + +Enumerated Types +^^^^^^^^^^^^^^^^ + +.. ctype:: NPY_SORTKIND + + A special variable-type which can take on the values :cdata:`NPY_{KIND}` + where ``{KIND}`` is + + **QUICKSORT**, **HEAPSORT**, **MERGESORT** + + .. cvar:: NPY_NSORTS + + Defined to be the number of sorts. + +.. ctype:: NPY_SCALARKIND + + A special variable type indicating the number of "kinds" of + scalars distinguished in determining scalar-coercion rules. This + variable can take on the values :cdata:`NPY_{KIND}` where ``{KIND}`` can be + + **NOSCALAR**, **BOOL_SCALAR**, **INTPOS_SCALAR**, + **INTNEG_SCALAR**, **FLOAT_SCALAR**, **COMPLEX_SCALAR**, + **OBJECT_SCALAR** + + + .. cvar:: NPY_NSCALARKINDS + + Defined to be the number of scalar kinds + (not including :cdata:`NPY_NOSCALAR`). + +.. ctype:: NPY_ORDER + + A variable type indicating the order that an array should be + interpreted in. The value of a variable of this type can be + :cdata:`NPY_{ORDER}` where ``{ORDER}`` is + + **ANYORDER**, **CORDER**, **FORTRANORDER** + +.. ctype:: NPY_CLIPMODE + + A variable type indicating the kind of clipping that should be + applied in certain functions. The value of a variable of this type + can be :cdata:`NPY_{MODE}` where ``{MODE}`` is + + **CLIP**, **WRAP**, **RAISE** + +.. index:: + pair: ndarray; C-API Added: numpy-docs/trunk/source/reference/c-api.config.rst =================================================================== --- numpy-docs/trunk/source/reference/c-api.config.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/c-api.config.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,110 @@ +Configuration defines +===================== + +.. sectionauthor:: Travis E. Oliphant + +When NumPy is built, a configuration file is constructed and placed as +config.h in the NumPy include directory. This configuration file +ensures that specific macros are defined and defines other macros +based on whether or not your system has certain features. It is +included by the arrayobject.h file. + + +Guaranteed to be defined +------------------------ + +The :cdata:`SIZEOF_{CTYPE}` constants are defined so that sizeof +information is available to the pre-processor. + +.. cvar:: CHAR_BIT + + The number of bits of a char. The char is the unit of all sizeof + definitions + +.. cvar:: SIZEOF_SHORT + + sizeof(short) + +.. cvar:: SIZEOF_INT + + sizeof(int) + +.. cvar:: SIZEOF_LONG + + sizeof(long) + +.. cvar:: SIZEOF_LONG_LONG + + sizeof(longlong) where longlong is defined appropriately on the + platform (A macro defines **SIZEOF_LONGLONG** as well.) + +.. cvar:: SIZEOF_PY_LONG_LONG + + +.. cvar:: SIZEOF_FLOAT + + sizeof(float) + +.. cvar:: SIZEOF_DOUBLE + + sizeof(double) + +.. cvar:: SIZEOF_LONG_DOUBLE + + sizeof(longdouble) (A macro defines **SIZEOF_LONGDOUBLE** as well.) + +.. cvar:: SIZEOF_PY_INTPTR_T + + Size of a pointer on this platform (sizeof(void \*)) (A macro defines + SIZEOF_INTP as well.) + + +Possible defines +---------------- + +These defines will cause the compilation to ignore compatibility code +that is placed in NumPy and use the system code instead. If they are +not defined, then the system does not have that capability. + +.. cvar:: HAVE_LONGDOUBLE_FUNCS + + System has C99 long double math functions. + +.. cvar:: HAVE_FLOAT_FUNCS + + System has C99 float math functions. + +.. cvar:: HAVE_INVERSE_HYPERBOLIC + + System has inverse hyperbolic functions: asinh, acosh, and atanh. + +.. cvar:: HAVE_INVERSE_HYPERBOLIC_FLOAT + + System has C99 float extensions to inverse hyperbolic functions: + asinhf, acoshf, atanhf + +.. cvar:: HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE + + System has C99 long double extensions to inverse hyperbolic functions: + asinhl, acoshl, atanhl. + +.. cvar:: HAVE_ISNAN + + System has an isnan function. + +.. cvar:: HAVE_ISINF + + System has an isinf function. + +.. cvar:: HAVE_LOG1P + + System has the log1p function: :math:`\log\left(x+1\right)`. + +.. cvar:: HAVE_EXPM1 + + System has the expm1 function: :math:`\exp\left(x\right)-1`. + +.. cvar:: HAVE_RINT + + System has the rint function. + Added: numpy-docs/trunk/source/reference/c-api.dtype.rst =================================================================== --- numpy-docs/trunk/source/reference/c-api.dtype.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/c-api.dtype.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,218 @@ +Data Type API +============= + +.. sectionauthor:: Travis E. Oliphant + +The standard array can have 21 different data types (and has some +support for adding your own types). These data types all have an +enumerated type, an enumerated type-character, and a corresponding +array scalar Python type object (placed in a hierarchy). There are +also standard C typedefs to make it easier to manipulate elements of +the given data type. For the numeric types, there are also bit-width +equivalent C typedefs and named typenumbers that make it easier to +select the precision desired. + +.. warning:: + + The names for the types in c code follows c naming conventions + more closely. The Python names for these types follow Python + conventions. Thus, :cdata:`NPY_FLOAT` picks up a 32-bit float in + C, but :class:`numpy.float_` in Python corresponds to a 64-bit + double. The bit-width names can be used in both Python and C for + clarity. + + +Enumerated Types +---------------- + +There is a list of enumerated types defined providing the basic 21 +data types plus some useful generic names. Whenever the code requires +a type number, one of these enumerated types is requested. The types +are all called :cdata:`NPY_{NAME}` where ``{NAME}`` can be + + **BOOL**, **BYTE**, **UBYTE**, **SHORT**, **USHORT**, **INT**, + **UINT**, **LONG**, **ULONG**, **LONGLONG**, **ULONGLONG**, + **FLOAT**, **DOUBLE**, **LONGDOUBLE**, **CFLOAT**, **CDOUBLE**, + **CLONGDOUBLE**, **OBJECT**, **STRING**, **UNICODE**, **VOID** + + **NTYPES**, **NOTYPE**, **USERDEF**, **DEFAULT_TYPE** + +The various character codes indicating certain types are also part of +an enumerated list. References to type characters (should they be +needed at all) should always use these enumerations. The form of them +is :cdata:`NPY_{NAME}LTR` where ``{NAME}`` can be + + **BOOL**, **BYTE**, **UBYTE**, **SHORT**, **USHORT**, **INT**, + **UINT**, **LONG**, **ULONG**, **LONGLONG**, **ULONGLONG**, + **FLOAT**, **DOUBLE**, **LONGDOUBLE**, **CFLOAT**, **CDOUBLE**, + **CLONGDOUBLE**, **OBJECT**, **STRING**, **VOID** + + **INTP**, **UINTP** + + **GENBOOL**, **SIGNED**, **UNSIGNED**, **FLOATING**, **COMPLEX** + +The latter group of ``{NAME}s`` corresponds to letters used in the array +interface typestring specification. + + +Defines +------- + +Max and min values for integers +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. cvar:: NPY_MAX_INT{bits} + +.. cvar:: NPY_MAX_UINT{bits} + +.. cvar:: NPY_MIN_INT{bits} + + These are defined for ``{bits}`` = 8, 16, 32, 64, 128, and 256 and provide + the maximum (minimum) value of the corresponding (unsigned) integer + type. Note: the actual integer type may not be available on all + platforms (i.e. 128-bit and 256-bit integers are rare). + +.. cvar:: NPY_MIN_{type} + + This is defined for ``{type}`` = **BYTE**, **SHORT**, **INT**, + **LONG**, **LONGLONG**, **INTP** + +.. cvar:: NPY_MAX_{type} + + This is defined for all defined for ``{type}`` = **BYTE**, **UBYTE**, + **SHORT**, **USHORT**, **INT**, **UINT**, **LONG**, **ULONG**, + **LONGLONG**, **ULONGLONG**, **INTP**, **UINTP** + + +Number of bits in data types +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +All :cdata:`NPY_SIZEOF_{CTYPE}` constants have corresponding +:cdata:`NPY_BITSOF_{CTYPE}` constants defined. The :cdata:`NPY_BITSOF_{CTYPE}` +constants provide the number of bits in the data type. Specifically, +the available ``{CTYPE}s`` are + + **BOOL**, **CHAR**, **SHORT**, **INT**, **LONG**, + **LONGLONG**, **FLOAT**, **DOUBLE**, **LONGDOUBLE** + + +Bit-width references to enumerated typenums +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +All of the numeric data types (integer, floating point, and complex) +have constants that are defined to be a specific enumerated type +number. Exactly which enumerated type a bit-width type refers to is +platform dependent. In particular, the constants available are +:cdata:`PyArray_{NAME}{BITS}` where ``{NAME}`` is **INT**, **UINT**, +**FLOAT**, **COMPLEX** and ``{BITS}`` can be 8, 16, 32, 64, 80, 96, 128, +160, 192, 256, and 512. Obviously not all bit-widths are available on +all platforms for all the kinds of numeric types. Commonly 8-, 16-, +32-, 64-bit integers; 32-, 64-bit floats; and 64-, 128-bit complex +types are available. + + +Integer that can hold a pointer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The constants **PyArray_INTP** and **PyArray_UINTP** refer to an +enumerated integer type that is large enough to hold a pointer on the +platform. Index arrays should always be converted to **PyArray_INTP** +, because the dimension of the array is of type npy_intp. + + +C-type names +------------ + +There are standard variable types for each of the numeric data types +and the bool data type. Some of these are already available in the +C-specification. You can create variables in extension code with these +types. + + +Boolean +^^^^^^^ + +.. ctype:: npy_bool + + unsigned char; The constants :cdata:`NPY_FALSE` and + :cdata:`NPY_TRUE` are also defined. + + +(Un)Signed Integer +^^^^^^^^^^^^^^^^^^ + +Unsigned versions of the integers can be defined by pre-pending a 'u' +to the front of the integer name. + +.. ctype:: npy_(u)byte + + (unsigned) char + +.. ctype:: npy_(u)short + + (unsigned) short + +.. ctype:: npy_(u)int + + (unsigned) int + +.. ctype:: npy_(u)long + + (unsigned) long int + +.. ctype:: npy_(u)longlong + + (unsigned long long int) + +.. ctype:: npy_(u)intp + + (unsigned) Py_intptr_t (an integer that is the size of a pointer on + the platform). + + +(Complex) Floating point +^^^^^^^^^^^^^^^^^^^^^^^^ + +.. ctype:: npy_(c)float + + float + +.. ctype:: npy_(c)double + + double + +.. ctype:: npy_(c)longdouble + + long double + +complex types are structures with **.real** and **.imag** members (in +that order). + + +Bit-width names +^^^^^^^^^^^^^^^ + +There are also typedefs for signed integers, unsigned integers, +floating point, and complex floating point types of specific bit- +widths. The available type names are + + :ctype:`npy_int{bits}`, :ctype:`npy_uint{bits}`, :ctype:`npy_float{bits}`, + and :ctype:`npy_complex{bits}` + +where ``{bits}`` is the number of bits in the type and can be **8**, +**16**, **32**, **64**, 128, and 256 for integer types; 16, **32** +, **64**, 80, 96, 128, and 256 for floating-point types; and 32, +**64**, **128**, 160, 192, and 512 for complex-valued types. Which +bit-widths are available is platform dependent. The bolded bit-widths +are usually available on all platforms. + + +Printf Formatting +----------------- + +For help in printing, the following strings are defined as the correct +format specifier in printf and related commands. + + :cdata:`NPY_LONGLONG_FMT`, :cdata:`NPY_ULONGLONG_FMT`, + :cdata:`NPY_INTP_FMT`, :cdata:`NPY_UINTP_FMT`, + :cdata:`NPY_LONGDOUBLE_FMT` Added: numpy-docs/trunk/source/reference/c-api.rst =================================================================== --- numpy-docs/trunk/source/reference/c-api.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/c-api.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,47 @@ +.. _c-api: + +########### +Numpy C-API +########### + +.. sectionauthor:: Travis E. Oliphant + +| Beware of the man who won't be bothered with details. +| --- *William Feather, Sr.* + +| The truth is out there. +| --- *Chris Carter, The X Files* + + +NumPy provides a C-API to enable users to extend the system and get +access to the array object for use in other routines. The best way to +truly understand the C-API is to read the source code. If you are +unfamiliar with (C) source code, however, this can be a daunting +experience at first. Be assured that the task becomes easier with +practice, and you may be surprised at how simple the C-code can be to +understand. Even if you don't think you can write C-code from scratch, +it is much easier to understand and modify already-written source code +then create it *de novo*. + +Python extensions are especially straightforward to understand because +they all have a very similar structure. Admittedly, NumPy is not a +trivial extension to Python, and may take a little more snooping to +grasp. This is especially true because of the code-generation +techniques, which simplify maintenance of very similar code, but can +make the code a little less readable to beginners. Still, with a +little persistence, the code can be opened to your understanding. It +is my hope, that this guide to the C-API can assist in the process of +becoming familiar with the compiled-level work that can be done with +NumPy in order to squeeze that last bit of necessary speed out of your +code. + +.. currentmodule:: numpy-c-api + +.. toctree:: + :maxdepth: 2 + + c-api.types-and-structures + c-api.config + c-api.dtype + c-api.array + c-api.ufunc Added: numpy-docs/trunk/source/reference/c-api.types-and-structures.rst =================================================================== --- numpy-docs/trunk/source/reference/c-api.types-and-structures.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/c-api.types-and-structures.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,1173 @@ +***************************** +Python Types and C-Structures +***************************** + +.. sectionauthor:: Travis E. Oliphant + +Several new types are defined in the C-code. Most of these are +accessible from Python, but a few are not exposed due to their limited +use. Every new Python type has an associated :ctype:`PyObject *` with an +internal structure that includes a pointer to a "method table" that +defines how the new object behaves in Python. When you receive a +Python object into C code, you always get a pointer to a +:ctype:`PyObject` structure. Because a :ctype:`PyObject` structure is +very generic and defines only :cmacro:`PyObject_HEAD`, by itself it +is not very interesting. However, different objects contain more +details after the :cmacro:`PyObject_HEAD` (but you have to cast to the +correct type to access them --- or use accessor functions or macros). + + +New Python Types Defined +======================== + +Python types are the functional equivalent in C of classes in Python. +By constructing a new Python type you make available a new object for +Python. The ndarray object is an example of a new type defined in C. +New types are defined in C by two basic steps: + +1. creating a C-structure (usually named :ctype:`Py{Name}Object`) that is + binary- compatible with the :ctype:`PyObject` structure itself but holds + the additional information needed for that particular object; + +2. populating the :ctype:`PyTypeObject` table (pointed to by the ob_type + member of the :ctype:`PyObject` structure) with pointers to functions + that implement the desired behavior for the type. + +Instead of special method names which define behavior for Python +classes, there are "function tables" which point to functions that +implement the desired results. Since Python 2.2, the PyTypeObject +itself has become dynamic which allows C types that can be "sub-typed +"from other C-types in C, and sub-classed in Python. The children +types inherit the attributes and methods from their parent(s). + +There are two major new types: the ndarray ( :cdata:`PyArray_Type` ) +and the ufunc ( :cdata:`PyUFunc_Type` ). Additional types play a +supportive role: the :cdata:`PyArrayIter_Type`, the +:cdata:`PyArrayMultiIter_Type`, and the :cdata:`PyArrayDescr_Type` +. The :cdata:`PyArrayIter_Type` is the type for a flat iterator for an +ndarray (the object that is returned when getting the flat +attribute). The :cdata:`PyArrayMultiIter_Type` is the type of the +object returned when calling ``broadcast`` (). It handles iteration +and broadcasting over a collection of nested sequences. Also, the +:cdata:`PyArrayDescr_Type` is the data-type-descriptor type whose +instances describe the data. Finally, there are 21 new scalar-array +types which are new Python scalars corresponding to each of the +fundamental data types available for arrays. An additional 10 other +types are place holders that allow the array scalars to fit into a +hierarchy of actual Python types. + + +PyArray_Type +------------ + +.. cvar:: PyArray_Type + + The Python type of the ndarray is :cdata:`PyArray_Type`. In C, every + ndarray is a pointer to a :ctype:`PyArrayObject` structure. The ob_type + member of this structure contains a pointer to the :cdata:`PyArray_Type` + typeobject. + +.. ctype:: PyArrayObject + + The :ctype:`PyArrayObject` C-structure contains all of the required + information for an array. All instances of an ndarray (and its + subclasses) will have this structure. For future compatibility, + these structure members should normally be accessed using the + provided macros. If you need a shorter name, then you can make use + of :ctype:`NPY_AO` which is defined to be equivalent to + :ctype:`PyArrayObject`. + + .. code-block:: c + + typedef struct PyArrayObject { + PyObject_HEAD + char *data; + int nd; + npy_intp *dimensions; + npy_intp *strides; + PyObject *base; + PyArray_Descr *descr; + int flags; + PyObject *weakreflist; + } PyArrayObject; + +.. cmacro:: PyArrayObject.PyObject_HEAD + + This is needed by all Python objects. It consists of (at least) + a reference count member ( ``ob_refcnt`` ) and a pointer to the + typeobject ( ``ob_type`` ). (Other elements may also be present + if Python was compiled with special options see + Include/object.h in the Python source tree for more + information). The ob_type member points to a Python type + object. + +.. cmember:: char *PyArrayObject.data + + A pointer to the first element of the array. This pointer can + (and normally should) be recast to the data type of the array. + +.. cmember:: int PyArrayObject.nd + + An integer providing the number of dimensions for this + array. When nd is 0, the array is sometimes called a rank-0 + array. Such arrays have undefined dimensions and strides and + cannot be accessed. :cdata:`NPY_MAXDIMS` is the largest number of + dimensions for any array. + +.. cmember:: npy_intp PyArrayObject.dimensions + + An array of integers providing the shape in each dimension as + long as nd :math:`\geq` 1. The integer is always large enough + to hold a pointer on the platform, so the dimension size is + only limited by memory. + +.. cmember:: npy_intp *PyArrayObject.strides + + An array of integers providing for each dimension the number of + bytes that must be skipped to get to the next element in that + dimension. + +.. cmember:: PyObject *PyArrayObject.base + + This member is used to hold a pointer to another Python object + that is related to this array. There are two use cases: 1) If + this array does not own its own memory, then base points to the + Python object that owns it (perhaps another array object), 2) + If this array has the :cdata:`NPY_UPDATEIFCOPY` flag set, then this + array is a working copy of a "misbehaved" array. As soon as + this array is deleted, the array pointed to by base will be + updated with the contents of this array. + +.. cmember:: PyArray_Descr *PyArrayObject.descr + + A pointer to a data-type descriptor object (see below). The + data-type descriptor object is an instance of a new built-in + type which allows a generic description of memory. There is a + descriptor structure for each data type supported. This + descriptor structure contains useful information about the type + as well as a pointer to a table of function pointers to + implement specific functionality. + +.. cmember:: int PyArrayObject.flags + + Flags indicating how the memory pointed to by data is to be + interpreted. Possible flags are :cdata:`NPY_C_CONTIGUOUS`, + :cdata:`NPY_F_CONTIGUOUS`, :cdata:`NPY_OWNDATA`, :cdata:`NPY_ALIGNED`, + :cdata:`NPY_WRITEABLE`, and :cdata:`NPY_UPDATEIFCOPY`. + +.. cmember:: PyObject *PyArrayObject.weakreflist + + This member allows array objects to have weak references (using the + weakref module). + + +PyArrayDescr_Type +----------------- + +.. cvar:: PyArrayDescr_Type + + The :cdata:`PyArrayDescr_Type` is the built-in type of the + data-type-descriptor objects used to describe how the bytes comprising + the array are to be interpreted. There are 21 statically-defined + :ctype:`PyArray_Descr` objects for the built-in data-types. While these + participate in reference counting, their reference count should never + reach zero. There is also a dynamic table of user-defined + :ctype:`PyArray_Descr` objects that is also maintained. Once a + data-type-descriptor object is "registered" it should never be + deallocated either. The function :cfunc:`PyArray_DescrFromType` (...) can + be used to retrieve a :ctype:`PyArray_Descr` object from an enumerated + type-number (either built-in or user- defined). + +.. ctype:: PyArray_Descr + + The format of the :ctype:`PyArray_Descr` structure that lies at the + heart of the :cdata:`PyArrayDescr_Type` is + + .. code-block:: c + + typedef struct { + PyObject_HEAD + PyTypeObject *typeobj; + char kind; + char type; + char byteorder; + char hasobject; + int type_num; + int elsize; + int alignment; + PyArray_ArrayDescr *subarray; + PyObject *fields; + PyArray_ArrFuncs *f; + } PyArray_Descr; + +.. cmember:: PyTypeObject *PyArray_Descr.typeobj + + Pointer to a typeobject that is the corresponding Python type for + the elements of this array. For the builtin types, this points to + the corresponding array scalar. For user-defined types, this + should point to a user-defined typeobject. This typeobject can + either inherit from array scalars or not. If it does not inherit + from array scalars, then the :cdata:`NPY_USE_GETITEM` and + :cdata:`NPY_USE_SETITEM` flags should be set in the ``hasobject`` flag. + +.. cmember:: char PyArray_Descr.kind + + A character code indicating the kind of array (using the array + interface typestring notation). A 'b' represents Boolean, a 'i' + represents signed integer, a 'u' represents unsigned integer, 'f' + represents floating point, 'c' represents complex floating point, 'S' + represents 8-bit character string, 'U' represents 32-bit/character + unicode string, and 'V' repesents arbitrary. + +.. cmember:: char PyArray_Descr.type + + A traditional character code indicating the data type. + +.. cmember:: char PyArray_Descr.byteorder + + A character indicating the byte-order: '>' (big-endian), '<' (little- + endian), '=' (native), '\|' (irrelevant, ignore). All builtin data- + types have byteorder '='. + +.. cmember:: char PyArray_Descr.hasobject + + A data-type bit-flag that determines if the data-type exhibits object- + array like behavior. Each bit in this member is a flag which are named + as: + + .. cvar:: NPY_ITEM_REFCOUNT + + .. cvar:: NPY_ITEM_HASOBJECT + + Indicates that items of this data-type must be reference + counted (using :cfunc:`Py_INCREF` and :cfunc:`Py_DECREF` ). + + .. cvar:: NPY_ITEM_LISTPICKLE + + Indicates arrays of this data-type must be converted to a list + before pickling. + + .. cvar:: NPY_ITEM_IS_POINTER + + Indicates the item is a pointer to some other data-type + + .. cvar:: NPY_NEEDS_INIT + + Indicates memory for this data-type must be initialized (set + to 0) on creation. + + .. cvar:: NPY_NEEDS_PYAPI + + Indicates this data-type requires the Python C-API during + access (so don't give up the GIL if array access is going to + be needed). + + .. cvar:: NPY_USE_GETITEM + + On array access use the ``f->getitem`` function pointer + instead of the standard conversion to an array scalar. Must + use if you don't define an array scalar to go along with + the data-type. + + .. cvar:: NPY_USE_SETITEM + + When creating a 0-d array from an array scalar use + ``f->setitem`` instead of the standard copy from an array + scalar. Must use if you don't define an array scalar to go + along with the data-type. + + .. cvar:: NPY_FROM_FIELDS + + The bits that are inherited for the parent data-type if these + bits are set in any field of the data-type. Currently ( + :cdata:`NPY_NEEDS_INIT` \| :cdata:`NPY_LIST_PICKLE` \| + :cdata:`NPY_ITEM_REFCOUNT` \| :cdata:`NPY_NEEDS_PYAPI` ). + + .. cvar:: NPY_OBJECT_DTYPE_FLAGS + + Bits set for the object data-type: ( :cdata:`NPY_LIST_PICKLE` + \| :cdata:`NPY_USE_GETITEM` \| :cdata:`NPY_ITEM_IS_POINTER` \| + :cdata:`NPY_REFCOUNT` \| :cdata:`NPY_NEEDS_INIT` \| + :cdata:`NPY_NEEDS_PYAPI`). + + .. cfunction:: PyDataType_FLAGCHK(PyArray_Descr *dtype, int flags) + + Return true if all the given flags are set for the data-type + object. + + .. cfunction:: PyDataType_REFCHK(PyArray_Descr *dtype) + + Equivalent to :cfunc:`PyDataType_FLAGCHK` (*dtype*, + :cdata:`NPY_ITEM_REFCOUNT`). + +.. cmember:: int PyArray_Descr.type_num + + A number that uniquely identifies the data type. For new data-types, + this number is assigned when the data-type is registered. + +.. cmember:: int PyArray_Descr.elsize + + For data types that are always the same size (such as long), this + holds the size of the data type. For flexible data types where + different arrays can have a different elementsize, this should be + 0. + +.. cmember:: int PyArray_Descr.alignment + + A number providing alignment information for this data type. + Specifically, it shows how far from the start of a 2-element + structure (whose first element is a ``char`` ), the compiler + places an item of this type: ``offsetof(struct {char c; type v;}, + v)`` + +.. cmember:: PyArray_ArrayDescr *PyArray_Descr.subarray + + If this is non- ``NULL``, then this data-type descriptor is a + C-style contiguous array of another data-type descriptor. In + other-words, each element that this descriptor describes is + actually an array of some other base descriptor. This is most + useful as the data-type descriptor for a field in another + data-type descriptor. The fields member should be ``NULL`` if this + is non- ``NULL`` (the fields member of the base descriptor can be + non- ``NULL`` however). The :ctype:`PyArray_ArrayDescr` structure is + defined using + + .. code-block:: c + + typedef struct { + PyArray_Descr *base; + PyObject *shape; + } PyArray_ArrayDescr; + + The elements of this structure are: + + .. cmember:: PyArray_Descr *PyArray_ArrayDescr.base + + The data-type-descriptor object of the base-type. + + .. cmember:: PyObject *PyArray_ArrayDescr.shape + + The shape (always C-style contiguous) of the sub-array as a Python + tuple. + + +.. cmember:: PyObject *PyArray_Descr.fields + + If this is non-NULL, then this data-type-descriptor has fields + described by a Python dictionary whose keys are names (and also + titles if given) and whose values are tuples that describe the + fields. Recall that a data-type-descriptor always describes a + fixed-length set of bytes. A field is a named sub-region of that + total, fixed-length collection. A field is described by a tuple + composed of another data- type-descriptor and a byte + offset. Optionally, the tuple may contain a title which is + normally a Python string. These tuples are placed in this + dictionary keyed by name (and also title if given). + +.. cmember:: PyArray_ArrFuncs *PyArray_Descr.f + + A pointer to a structure containing functions that the type needs + to implement internal features. These functions are not the same + thing as the universal functions (ufuncs) described later. Their + signatures can vary arbitrarily. + +.. ctype:: PyArray_ArrFuncs + + Functions implementing internal features. Not all of these + function pointers must be defined for a given type. The required + members are ``nonzero``, ``copyswap``, ``copyswapn``, ``setitem``, + ``getitem``, and ``cast``. These are assumed to be non- ``NULL`` + and ``NULL`` entries will cause a program crash. The other + functions may be ``NULL`` which will just mean reduced + functionality for that data-type. (Also, the nonzero function will + be filled in with a default function if it is ``NULL`` when you + register a user-defined data-type). + + .. code-block:: c + + typedef struct { + PyArray_VectorUnaryFunc *cast[PyArray_NTYPES]; + PyArray_GetItemFunc *getitem; + PyArray_SetItemFunc *setitem; + PyArray_CopySwapNFunc *copyswapn; + PyArray_CopySwapFunc *copyswap; + PyArray_CompareFunc *compare; + PyArray_ArgFunc *argmax; + PyArray_DotFunc *dotfunc; + PyArray_ScanFunc *scanfunc; + PyArray_FromStrFunc *fromstr; + PyArray_NonzeroFunc *nonzero; + PyArray_FillFunc *fill; + PyArray_FillWithScalarFunc *fillwithscalar; + PyArray_SortFunc *sort[PyArray_NSORTS]; + PyArray_ArgSortFunc *argsort[PyArray_NSORTS]; + PyObject *castdict; + PyArray_ScalarKindFunc *scalarkind; + int **cancastscalarkindto; + int *cancastto; + int listpickle + } PyArray_ArrFuncs; + + The concept of a behaved segment is used in the description of the + function pointers. A behaved segment is one that is aligned and in + native machine byte-order for the data-type. The ``nonzero``, + ``copyswap``, ``copyswapn``, ``getitem``, and ``setitem`` + functions can (and must) deal with mis-behaved arrays. The other + functions require behaved memory segments. + + .. cmember:: void cast(void *from, void *to, npy_intp n, void *fromarr, void *toarr) + + An array of function pointers to cast from the current type to + all of the other builtin types. Each function casts a + contiguous, aligned, and notswapped buffer pointed at by + *from* to a contiguous, aligned, and notswapped buffer pointed + at by *to* The number of items to cast is given by *n*, and + the arguments *fromarr* and *toarr* are interpreted as + PyArrayObjects for flexible arrays to get itemsize + information. + + .. cmember:: PyObject *getitem(void *data, void *arr) + + A pointer to a function that returns a standard Python object + from a single element of the array object *arr* pointed to by + *data*. This function must be able to deal with "misbehaved + "(misaligned and/or swapped) arrays correctly. + + .. cmember:: int setitem(PyObject *item, void *data, void *arr) + + A pointer to a function that sets the Python object *item* + into the array, *arr*, at the position pointed to by *data* + . This function deals with "misbehaved" arrays. If successful, + a zero is returned, otherwise, a negative one is returned (and + a Python error set). + + .. cmember:: void copyswapn(void *dest, npy_intp dstride, void *src, npy_intp sstride, npy_intp n, int swap, void *arr) + + .. cmember:: void copyswap(void *dest, void *src, int swap, void *arr) + + These members are both pointers to functions to copy data from + *src* to *dest* and *swap* if indicated. The value of arr is + only used for flexible ( :cdata:`NPY_STRING`, :cdata:`NPY_UNICODE`, + and :cdata:`NPY_VOID` ) arrays (and is obtained from + ``arr->descr->elsize`` ). The second function copies a single + value, while the first loops over n values with the provided + strides. These functions can deal with misbehaved *src* + data. If *src* is NULL then no copy is performed. If *swap* is + 0, then no byteswapping occurs. It is assumed that *dest* and + *src* do not overlap. If they overlap, then use ``memmove`` + (...) first followed by ``copyswap(n)`` with NULL valued + ``src``. + + .. cmember:: int compare(const void* d1, const void* d2, void* arr) + + A pointer to a function that compares two elements of the + array, ``arr``, pointed to by ``d1`` and ``d2``. This + function requires behaved arrays. The return value is 1 if * + ``d1`` > * ``d2``, 0 if * ``d1`` == * ``d2``, and -1 if * + ``d1`` < * ``d2``. The array object arr is used to retrieve + itemsize and field information for flexible arrays. + + .. cmember:: int argmax(void* data, npy_intp n, npy_intp* max_ind, void* arr) + + A pointer to a function that retrieves the index of the + largest of ``n`` elements in ``arr`` beginning at the element + pointed to by ``data``. This function requires that the + memory segment be contiguous and behaved. The return value is + always 0. The index of the largest element is returned in + ``max_ind``. + + .. cmember:: void dotfunc(void* ip1, npy_intp is1, void* ip2, npy_intp is2, void* op, npy_intp n, void* arr) + + A pointer to a function that multiplies two ``n`` -length + sequences together, adds them, and places the result in + element pointed to by ``op`` of ``arr``. The start of the two + sequences are pointed to by ``ip1`` and ``ip2``. To get to + the next element in each sequence requires a jump of ``is1`` + and ``is2`` *bytes*, respectively. This function requires + behaved (though not necessarily contiguous) memory. + + .. cmember:: int scanfunc(FILE* fd, void* ip , void* sep , void* arr) + + A pointer to a function that scans (scanf style) one element + of the corresponding type from the file descriptor ``fd`` into + the array memory pointed to by ``ip``. The array is assumed + to be behaved. If ``sep`` is not NULL, then a separator string + is also scanned from the file before returning. The last + argument ``arr`` is the array to be scanned into. A 0 is + returned if the scan is successful. A negative number + indicates something went wrong: -1 means the end of file was + reached before the separator string could be scanned, -4 means + that the end of file was reached before the element could be + scanned, and -3 means that the element could not be + interpreted from the format string. Requires a behaved array. + + .. cmember:: int fromstr(char* str, void* ip, char** endptr, void* arr) + + A pointer to a function that converts the string pointed to by + ``str`` to one element of the corresponding type and places it + in the memory location pointed to by ``ip``. After the + conversion is completed, ``*endptr`` points to the rest of the + string. The last argument ``arr`` is the array into which ip + points (needed for variable-size data- types). Returns 0 on + success or -1 on failure. Requires a behaved array. + + .. cmember:: Bool nonzero(void* data, void* arr) + + A pointer to a function that returns TRUE if the item of + ``arr`` pointed to by ``data`` is nonzero. This function can + deal with misbehaved arrays. + + .. cmember:: void fill(void* data, npy_intp length, void* arr) + + A pointer to a function that fills a contiguous array of given + length with data. The first two elements of the array must + already be filled- in. From these two values, a delta will be + computed and the values from item 3 to the end will be + computed by repeatedly adding this computed delta. The data + buffer must be well-behaved. + + .. cmember:: void fillwithscalar(void* buffer, npy_intp length, void* value, void* arr) + + A pointer to a function that fills a contiguous ``buffer`` of + the given ``length`` with a single scalar ``value`` whose + address is given. The final argument is the array which is + needed to get the itemsize for variable-length arrays. + + .. cmember:: int sort(void* start, npy_intp length, void* arr) + + An array of function pointers to a particular sorting + algorithms. A particular sorting algorithm is obtained using a + key (so far :cdata:`PyArray_QUICKSORT`, :data`PyArray_HEAPSORT`, and + :cdata:`PyArray_MERGESORT` are defined). These sorts are done + in-place assuming contiguous and aligned data. + + .. cmember:: int argsort(void* start, npy_intp* result, npy_intp length, void \*arr) + + An array of function pointers to sorting algorithms for this + data type. The same sorting algorithms as for sort are + available. The indices producing the sort are returned in + result (which must be initialized with indices 0 to length-1 + inclusive). + + .. cmember:: PyObject *castdict + + Either ``NULL`` or a dictionary containing low-level casting + functions for user- defined data-types. Each function is + wrapped in a :ctype:`PyCObject *` and keyed by the data-type number. + + .. cmember:: PyArray_SCALARKIND scalarkind(PyArrayObject* arr) + + A function to determine how scalars of this type should be + interpreted. The argument is ``NULL`` or a 0-dimensional array + containing the data (if that is needed to determine the kind + of scalar). The return value must be of type + :ctype:`PyArray_SCALARKIND`. + + .. cmember:: int **cancastscalarkindto + + Either ``NULL`` or an array of :ctype:`PyArray_NSCALARKINDS` + pointers. These pointers should each be either ``NULL`` or a + pointer to an array of integers (terminated by + :cdata:`PyArray_NOTYPE`) indicating data-types that a scalar of + this data-type of the specified kind can be cast to safely + (this usually means without losing precision). + + .. cmember:: int *cancastto + + Either ``NULL`` or an array of integers (terminated by + :cdata:`PyArray_NOTYPE` ) indicated data-types that this data-type + can be cast to safely (this usually means without losing + precision). + + .. cmember:: int listpickle + + Unused. + +The :cdata:`PyArray_Type` typeobject implements many of the features of +Python objects including the tp_as_number, tp_as_sequence, +tp_as_mapping, and tp_as_buffer interfaces. The rich comparison +(tp_richcompare) is also used along with new-style attribute lookup +for methods (tp_methods) and properties (tp_getset). The +:cdata:`PyArray_Type` can also be sub-typed. + +.. tip:: + + The tp_as_number methods use a generic approach to call whatever + function has been registered for handling the operation. The + function PyNumeric_SetOps(..) can be used to register functions to + handle particular mathematical operations (for all arrays). When + the umath module is imported, it sets the numeric operations for + all arrays to the corresponding ufuncs. The tp_str and tp_repr + methods can also be altered using PyString_SetStringFunction(...). + + +PyUFunc_Type +------------ + +.. cvar:: PyUFunc_Type + + The ufunc object is implemented by creation of the + :cdata:`PyUFunc_Type`. It is a very simple type that implements only + basic getattribute behavior, printing behavior, and has call + behavior which allows these objects to act like functions. The + basic idea behind the ufunc is to hold a reference to fast + 1-dimensional (vector) loops for each data type that supports the + operation. These one-dimensional loops all have the same signature + and are the key to creating a new ufunc. They are called by the + generic looping code as appropriate to implement the N-dimensional + function. There are also some generic 1-d loops defined for + floating and complexfloating arrays that allow you to define a + ufunc using a single scalar function (*e.g.* atanh). + + +.. ctype:: PyUFuncObject + + The core of the ufunc is the :ctype:`PyUFuncObject` which contains all + the information needed to call the underlying C-code loops that + perform the actual work. It has the following structure: + + .. code-block:: c + + typedef struct { + PyObject_HEAD + int nin; + int nout; + int nargs; + int identity; + PyUFuncGenericFunction *functions; + void **data; + int ntypes; + int check_return; + char *name; + char *types; + char *doc; + void *ptr; + PyObject *obj; + PyObject *userloops; + } PyUFuncObject; + + .. cmacro:: PyUFuncObject.PyObject_HEAD + + required for all Python objects. + + .. cmember:: int PyUFuncObject.nin + + The number of input arguments. + + .. cmember:: int PyUFuncObject.nout + + The number of output arguments. + + .. cmember:: int PyUFuncObject.nargs + + The total number of arguments (*nin* + *nout*). This must be + less than :cdata:`NPY_MAXARGS`. + + .. cmember:: int PyUFuncObject.identity + + Either :cdata:`PyUFunc_One`, :cdata:`PyUFunc_Zero`, or :cdata:`PyUFunc_None` + to indicate the identity for this operation. It is only used + for a reduce-like call on an empty array. + + .. cmember:: void PyUFuncObject.functions(char** args, npy_intp* dims, npy_intp* steps, void* extradata) + + An array of function pointers --- one for each data type + supported by the ufunc. This is the vector loop that is called + to implement the underlying function *dims* [0] times. The + first argument, *args*, is an array of *nargs* pointers to + behaved memory. Pointers to the data for the input arguments + are first, followed by the pointers to the data for the output + arguments. How many bytes must be skipped to get to the next + element in the sequence is specified by the corresponding entry + in the *steps* array. The last argument allows the loop to + receive extra information. This is commonly used so that a + single, generic vector loop can be used for multiple + functions. In this case, the actual scalar function to call is + passed in as *extradata*. The size of this function pointer + array is ntypes. + + .. cmember:: void **PyUFuncObject.data + + Extra data to be passed to the 1-d vector loops or ``NULL`` if + no extra-data is needed. This C-array must be the same size ( + *i.e.* ntypes) as the functions array. ``NULL`` is used if + extra_data is not needed. Several C-API calls for UFuncs are + just 1-d vector loops that make use of this extra data to + receive a pointer to the actual function to call. + + .. cmember:: int PyUFuncObject.ntypes + + The number of supported data types for the ufunc. This number + specifies how many different 1-d loops (of the builtin data types) are + available. + + .. cmember:: int PyUFuncObject.check_return + + Obsolete and unused. However, it is set by the corresponding entry in + the main ufunc creation routine: :cfunc:`PyUFunc_FromFuncAndData` (...). + + .. cmember:: char *PyUFuncObject.name + + A string name for the ufunc. This is used dynamically to build + the __doc\__ attribute of ufuncs. + + .. cmember:: char *PyUFuncObject.types + + An array of *nargs* :math:`\times` *ntypes* 8-bit type_numbers + which contains the type signature for the function for each of + the supported (builtin) data types. For each of the *ntypes* + functions, the corresponding set of type numbers in this array + shows how the *args* argument should be interpreted in the 1-d + vector loop. These type numbers do not have to be the same type + and mixed-type ufuncs are supported. + + .. cmember:: char *PyUFuncObject.doc + + Documentation for the ufunc. Should not contain the function + signature as this is generated dynamically when __doc\__ is + retrieved. + + .. cmember:: void *PyUFuncObject.ptr + + Any dynamically allocated memory. Currently, this is used for dynamic + ufuncs created from a python function to store room for the types, + data, and name members. + + .. cmember:: PyObject *PyUFuncObject.obj + + For ufuncs dynamically created from python functions, this member + holds a reference to the underlying Python function. + + .. cmember:: PyObject *PyUFuncObject.userloops + + A dictionary of user-defined 1-d vector loops (stored as CObject ptrs) + for user-defined types. A loop may be registered by the user for any + user-defined type. It is retrieved by type number. User defined type + numbers are always larger than :cdata:`NPY_USERDEF`. + + +PyArrayIter_Type +---------------- + +.. cvar:: PyArrayIter_Type + + This is an iterator object that makes it easy to loop over an N-dimensional + array. It is the object returned from the flat attribute of an + ndarray. It is also used extensively throughout the implementation + internals to loop over an N-dimensional array. The tp_as_mapping + interface is implemented so that the iterator object can be indexed + (using 1-d indexing), and a few methods are implemented through the + tp_methods table. This object implements the next method and can be + used anywhere an iterator can be used in Python. + +.. ctype:: PyArrayIterObject + + The C-structure corresponding to an object of :cdata:`PyArrayIter_Type` is + the :ctype:`PyArrayIterObject`. The :ctype:`PyArrayIterObject` is used to keep + track of a pointer into an N-dimensional array. It contains associated + information used to quickly march through the array. The pointer can + be adjusted in three basic ways: 1) advance to the "next" position in + the array in a C-style contiguous fashion, 2) advance to an arbitrary + N-dimensional coordinate in the array, and 3) advance to an arbitrary + one-dimensional index into the array. The members of the + :ctype:`PyArrayIterObject` structure are used in these + calculations. Iterator objects keep their own dimension and strides + information about an array. This can be adjusted as needed for + "broadcasting," or to loop over only specific dimensions. + + .. code-block:: c + + typedef struct { + PyObject_HEAD + int nd_m1; + npy_intp index; + npy_intp size; + npy_intp coordinates[NPY_MAXDIMS]; + npy_intp dims_m1[NPY_MAXDIMS]; + npy_intp strides[NPY_MAXDIMS]; + npy_intp backstrides[NPY_MAXDIMS]; + npy_intp factors[NPY_MAXDIMS]; + PyArrayObject *ao; + char *dataptr; + Bool contiguous; + } PyArrayIterObject; + + .. cmember:: int PyArrayIterObject.nd_m1 + + :math:`N-1` where :math:`N` is the number of dimensions in the + underlying array. + + .. cmember:: npy_intp PyArrayIterObject.index + + The current 1-d index into the array. + + .. cmember:: npy_intp PyArrayIterObject.size + + The total size of the underlying array. + + .. cmember:: npy_intp *PyArrayIterObject.coordinates + + An :math:`N` -dimensional index into the array. + + .. cmember:: npy_intp *PyArrayIterObject.dims_m1 + + The size of the array minus 1 in each dimension. + + .. cmember:: npy_intp *PyArrayIterObject.strides + + The strides of the array. How many bytes needed to jump to the next + element in each dimension. + + .. cmember:: npy_intp *PyArrayIterObject.backstrides + + How many bytes needed to jump from the end of a dimension back + to its beginning. Note that *backstrides* [k]= *strides* [k]*d + *ims_m1* [k], but it is stored here as an optimization. + + .. cmember:: npy_intp *PyArrayIterObject.factors + + This array is used in computing an N-d index from a 1-d index. It + contains needed products of the dimensions. + + .. cmember:: PyArrayObject *PyArrayIterObject.ao + + A pointer to the underlying ndarray this iterator was created to + represent. + + .. cmember:: char *PyArrayIterObject.dataptr + + This member points to an element in the ndarray indicated by the + index. + + .. cmember:: Bool PyArrayIterObject.contiguous + + This flag is true if the underlying array is + :cdata:`NPY_C_CONTIGUOUS`. It is used to simplify calculations when + possible. + + +How to use an array iterator on a C-level is explained more fully in +later sections. Typically, you do not need to concern yourself with +the internal structure of the iterator object, and merely interact +with it through the use of the macros :cfunc:`PyArray_ITER_NEXT` (it), +:cfunc:`PyArray_ITER_GOTO` (it, dest), or :cfunc:`PyArray_ITER_GOTO1D` (it, +index). All of these macros require the argument *it* to be a +:ctype:`PyArrayIterObject *`. + + +PyArrayMultiIter_Type +--------------------- + +.. cvar:: PyArrayMultiIter_Type + + This type provides an iterator that encapsulates the concept of + broadcasting. It allows :math:`N` arrays to be broadcast together + so that the loop progresses in C-style contiguous fashion over the + broadcasted array. The corresponding C-structure is the + :ctype:`PyArrayMultiIterObject` whose memory layout must begin any + object, *obj*, passed in to the :cfunc:`PyArray_Broadcast` (obj) + function. Broadcasting is performed by adjusting array iterators so + that each iterator represents the broadcasted shape and size, but + has its strides adjusted so that the correct element from the array + is used at each iteration. + + +.. ctype:: PyArrayMultiIterObject + + .. code-block:: c + + typedef struct { + PyObject_HEAD + int numiter; + npy_intp size; + npy_intp index; + int nd; + npy_intp dimensions[NPY_MAXDIMS]; + PyArrayIterObject *iters[NPY_MAXDIMS]; + } PyArrayMultiIterObject; + + .. cmacro:: PyArrayMultiIterObject.PyObject_HEAD + + Needed at the start of every Python object (holds reference count and + type identification). + + .. cmember:: int PyArrayMultiIterObject.numiter + + The number of arrays that need to be broadcast to the same shape. + + .. cmember:: npy_intp PyArrayMultiIterObject.size + + The total broadcasted size. + + .. cmember:: npy_intp PyArrayMultiIterObject.index + + The current (1-d) index into the broadcasted result. + + .. cmember:: int PyArrayMultiIterObject.nd + + The number of dimensions in the broadcasted result. + + .. cmember:: npy_intp *PyArrayMultiIterObject.dimensions + + The shape of the broadcasted result (only ``nd`` slots are used). + + .. cmember:: PyArrayIterObject **PyArrayMultiIterObject.iters + + An array of iterator objects that holds the iterators for the arrays + to be broadcast together. On return, the iterators are adjusted for + broadcasting. + + +PyArrayFlags_Type +----------------- + +.. cvar:: PyArrayFlags_Type + + When the flags attribute is retrieved from Python, a special + builtin object of this type is constructed. This special type makes + it easier to work with the different flags by accessing them as + attributes or by accessing them as if the object were a dictionary + with the flag names as entries. + + +ScalarArrayTypes +---------------- + +There is a Python type for each of the different built-in data types +that can be present in the array Most of these are simple wrappers +around the corresponding data type in C. The C-names for these types +are :cdata:`Py{TYPE}ArrType_Type` where ``{TYPE}`` can be + + **Bool**, **Byte**, **Short**, **Int**, **Long**, **LongLong**, + **UByte**, **UShort**, **UInt**, **ULong**, **ULongLong**, + **Float**, **Double**, **LongDouble**, **CFloat**, **CDouble**, + **CLongDouble**, **String**, **Unicode**, **Void**, and + **Object**. + +These type names are part of the C-API and can therefore be created in +extension C-code. There is also a :cdata:`PyIntpArrType_Type` and a +:cdata:`PyUIntpArrType_Type` that are simple substitutes for one of the +integer types that can hold a pointer on the platform. The structure +of these scalar objects is not exposed to C-code. The function +:cfunc:`PyArray_ScalarAsCtype` (..) can be used to extract the C-type value +from the array scalar and the function :cfunc:`PyArray_Scalar` (...) can be +used to construct an array scalar from a C-value. + + +Other C-Structures +================== + +A few new C-structures were found to be useful in the development of +NumPy. These C-structures are used in at least one C-API call and are +therefore documented here. The main reason these structures were +defined is to make it easy to use the Python ParseTuple C-API to +convert from Python objects to a useful C-Object. + + +PyArray_Dims +------------ + +.. ctype:: PyArray_Dims + + This structure is very useful when shape and/or strides information is + supposed to be interpreted. The structure is: + + .. code-block:: c + + typedef struct { + npy_intp *ptr; + int len; + } PyArray_Dims; + + The members of this structure are + + .. cmember:: npy_intp *PyArray_Dims.ptr + + A pointer to a list of (:ctype:`npy_intp`) integers which usually + represent array shape or array strides. + + .. cmember:: int PyArray_Dims.len + + The length of the list of integers. It is assumed safe to + access *ptr* [0] to *ptr* [len-1]. + + +PyArray_Chunk +------------- + +.. ctype:: PyArray_Chunk + + This is equivalent to the buffer object structure in Python up to + the ptr member. On 32-bit platforms (*i.e.* if :cdata:`NPY_SIZEOF_INT` + == :cdata:`NPY_SIZEOF_INTP` ) or in Python 2.5, the len member also + matches an equivalent member of the buffer object. It is useful to + represent a generic single- segment chunk of memory. + + .. code-block:: c + + typedef struct { + PyObject_HEAD + PyObject *base; + void *ptr; + npy_intp len; + int flags; + } PyArray_Chunk; + + The members are + + .. cmacro:: PyArray_Chunk.PyObject_HEAD + + Necessary for all Python objects. Included here so that the + :ctype:`PyArray_Chunk` structure matches that of the buffer object + (at least to the len member). + + .. cmember:: PyObject *PyArray_Chunk.base + + The Python object this chunk of memory comes from. Needed so that + memory can be accounted for properly. + + .. cmember:: void *PyArray_Chunk.ptr + + A pointer to the start of the single-segment chunk of memory. + + .. cmember:: npy_intp PyArray_Chunk.len + + The length of the segment in bytes. + + .. cmember:: int PyArray_Chunk.flags + + Any data flags (*e.g.* :cdata:`NPY_WRITEABLE` ) that should be used + to interpret the memory. + + +PyArrayInterface +---------------- + +.. seealso:: :ref:`arrays.interface` + +.. ctype:: PyArrayInterface + + The :ctype:`PyArrayInterface` structure is defined so that NumPy and + other extension modules can use the rapid array interface + protocol. The :obj:`__array_struct__` method of an object that + supports the rapid array interface protocol should return a + :ctype:`PyCObject` that contains a pointer to a :ctype:`PyArrayInterface` + structure with the relevant details of the array. After the new + array is created, the attribute should be ``DECREF``'d which will + free the :ctype:`PyArrayInterface` structure. Remember to ``INCREF`` the + object (whose :obj:`__array_struct__` attribute was retrieved) and + point the base member of the new :ctype:`PyArrayObject` to this same + object. In this way the memory for the array will be managed + correctly. + + .. code-block:: c + + typedef struct { + int two; + int nd; + char typekind; + int itemsize; + int flags; + npy_intp *shape; + npy_intp *strides; + void *data; + PyObject *descr; + } PyArrayInterface; + + .. cmember:: int PyArrayInterface.two + + the integer 2 as a sanity check. + + .. cmember:: int PyArrayInterface.nd + + the number of dimensions in the array. + + .. cmember:: char PyArrayInterface.typekind + + A character indicating what kind of array is present according to the + typestring convention with 't' -> bitfield, 'b' -> Boolean, 'i' -> + signed integer, 'u' -> unsigned integer, 'f' -> floating point, 'c' -> + complex floating point, 'O' -> object, 'S' -> string, 'U' -> unicode, + 'V' -> void. + + .. cmember:: int PyArrayInterface.itemsize + + The number of bytes each item in the array requires. + + .. cmember:: int PyArrayInterface.flags + + Any of the bits :cdata:`NPY_C_CONTIGUOUS` (1), + :cdata:`NPY_F_CONTIGUOUS` (2), :cdata:`NPY_ALIGNED` (0x100), + :cdata:`NPY_NOTSWAPPED` (0x200), or :cdata:`NPY_WRITEABLE` + (0x400) to indicate something about the data. The + :cdata:`NPY_ALIGNED`, :cdata:`NPY_C_CONTIGUOUS`, and + :cdata:`NPY_F_CONTIGUOUS` flags can actually be determined from + the other parameters. The flag :cdata:`NPY_ARR_HAS_DESCR` + (0x800) can also be set to indicate to objects consuming the + version 3 array interface that the descr member of the + structure is present (it will be ignored by objects consuming + version 2 of the array interface). + + .. cmember:: npy_intp *PyArrayInterface.shape + + An array containing the size of the array in each dimension. + + .. cmember:: npy_intp *PyArrayInterface.strides + + An array containing the number of bytes to jump to get to the next + element in each dimension. + + .. cmember:: void *PyArrayInterface.data + + A pointer *to* the first element of the array. + + .. cmember:: PyObject *PyArrayInterface.descr + + A Python object describing the data-type in more detail (same + as the *descr* key in :obj:`__array_interface__`). This can be + ``NULL`` if *typekind* and *itemsize* provide enough + information. This field is also ignored unless + :cdata:`ARR_HAS_DESCR` flag is on in *flags*. + + +Internally used structures +-------------------------- + +Internally, the code uses some additional Python objects primarily for +memory management. These types are not accessible directly from +Python, and are not exposed to the C-API. They are included here only +for completeness and assistance in understanding the code. + + +.. ctype:: PyUFuncLoopObject + + A loose wrapper for a C-structure that contains the information + needed for looping. This is useful if you are trying to understand + the ufunc looping code. The :ctype:`PyUFuncLoopObject` is the associated + C-structure. It is defined in the ``ufuncobject.h`` header. + +.. ctype:: PyUFuncReduceObject + + A loose wrapper for the C-structure that contains the information + needed for reduce-like methods of ufuncs. This is useful if you are + trying to understand the reduce, accumulate, and reduce-at + code. The :ctype:`PyUFuncReduceObject` is the associated C-structure. It + is defined in the ``ufuncobject.h`` header. + +.. ctype:: PyUFunc_Loop1d + + A simple linked-list of C-structures containing the information needed + to define a 1-d loop for a ufunc for every defined signature of a + user-defined data-type. + +.. cvar:: PyArrayMapIter_Type + + Advanced indexing is handled with this Python type. It is simply a + loose wrapper around the C-structure containing the variables + needed for advanced array indexing. The associated C-structure, + :ctype:`PyArrayMapIterObject`, is useful if you are trying to + understand the advanced-index mapping code. It is defined in the + ``arrayobject.h`` header. This type is not exposed to Python and + could be replaced with a C-structure. As a Python type it takes + advantage of reference- counted memory management. + Added: numpy-docs/trunk/source/reference/c-api.ufunc.rst =================================================================== --- numpy-docs/trunk/source/reference/c-api.ufunc.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/c-api.ufunc.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,335 @@ +UFunc API +========= + +.. sectionauthor:: Travis E. Oliphant + +.. index:: + pair: ufunc; C-API + + +Constants +--------- + +.. cvar:: UFUNC_ERR_{HANDLER} + + ``{HANDLER}`` can be **IGNORE**, **WARN**, **RAISE**, or **CALL** + +.. cvar:: UFUNC_{THING}_{ERR} + + ``{THING}`` can be **MASK**, **SHIFT**, or **FPE**, and ``{ERR}`` can + be **DIVIDEBYZERO**, **OVERFLOW**, **UNDERFLOW**, and **INVALID**. + +.. cvar:: PyUFunc_{VALUE} + + ``{VALUE}`` can be **One** (1), **Zero** (0), or **None** (-1) + + +Macros +------ + +.. cmacro:: NPY_LOOP_BEGIN_THREADS + + Used in universal function code to only release the Python GIL if + loop->obj is not true (*i.e.* this is not an OBJECT array + loop). Requires use of :cmacro:`NPY_BEGIN_THREADS_DEF` in variable + declaration area. + +.. cmacro:: NPY_LOOP_END_THREADS + + Used in universal function code to re-acquire the Python GIL if it + was released (because loop->obj was not true). + +.. cfunction:: UFUNC_CHECK_ERROR(loop) + + A macro used internally to check for errors and goto fail if + found. This macro requires a fail label in the current code + block. The *loop* variable must have at least members (obj, + errormask, and errorobj). If *loop* ->obj is nonzero, then + :cfunc:`PyErr_Occurred` () is called (meaning the GIL must be held). If + *loop* ->obj is zero, then if *loop* ->errormask is nonzero, + :cfunc:`PyUFunc_checkfperr` is called with arguments *loop* ->errormask + and *loop* ->errobj. If the result of this check of the IEEE + floating point registers is true then the code redirects to the + fail label which must be defined. + +.. cfunction:: UFUNC_CHECK_STATUS(ret) + + A macro that expands to platform-dependent code. The *ret* + variable can can be any integer. The :cdata:`UFUNC_FPE_{ERR}` bits are + set in *ret* according to the status of the corresponding error + flags of the floating point processor. + + +Functions +--------- + +.. cfunction:: PyObject* PyUFunc_FromFuncAndData(PyUFuncGenericFunction* func, void** data, char* types, int ntypes, int nin, int nout, int identity, char* name, char* doc, int check_return) + + Create a new broadcasting universal function from required variables. + Each ufunc builds around the notion of an element-by-element + operation. Each ufunc object contains pointers to 1-d loops + implementing the basic functionality for each supported type. + + :param nin: + + The number of inputs to this operation. + + :param nout: + + The number of outputs + + :param ntypes: + + How many different data-type "signatures" the ufunc has implemented. + + :param func: + + Must to an array of length *ntypes* containing + :ctype:`PyUFuncGenericFunction` items. These items are pointers to + functions that acutally implement the underlying + (element-by-element) function :math:`N` times. T + + :param types: + + Must be of length (*nin* + *nout*) \* *ntypes*, and it + contains the data-types (built-in only) that the corresponding + function in the *func* array can deal with. + + :param data: + + Should be ``NULL`` or a pointer to an array of size *ntypes* + . This array may contain arbitrary extra-data to be passed to + the corresponding 1-d loop function in the func array. + + :param name: + + The name for the ufunc. + + :param doc: + + Allows passing in a documentation string to be stored with the + ufunc. The documentation string should not contain the name + of the function or the calling signature as that will be + dynamically determined from the object and available when + accessing the **__doc__** attribute of the ufunc. + + :param check_return: + + Unused and present for backwards compatibility of the C-API. A + corresponding *check_return* integer does exist in the ufunc + structure and it does get set with this value when the ufunc + object is created. + +.. cfunction:: int PyUFunc_RegisterLoopForType(PyUFuncObject* ufunc, int usertype, PyUFuncGenericFunction function, int* arg_types, void* data) + + This function allows the user to register a 1-d loop with an + already- created ufunc to be used whenever the ufunc is called + with any of its input arguments as the user-defined + data-type. This is needed in order to make ufuncs work with + built-in data-types. The data-type must have been previously + registered with the numpy system. The loop is passed in as + *function*. This loop can take arbitrary data which should be + passed in as *data*. The data-types the loop requires are passed + in as *arg_types* which must be a pointer to memory at least as + large as ufunc->nargs. + +.. cfunction:: int PyUFunc_ReplaceLoopBySignature(PyUFuncObject* ufunc, PyUFuncGenericFunction newfunc, int* signature, PyUFuncGenericFunction* oldfunc) + + Replace a 1-d loop matching the given *signature* in the + already-created *ufunc* with the new 1-d loop newfunc. Return the + old 1-d loop function in *oldfunc*. Return 0 on success and -1 on + failure. This function works only with built-in types (use + :cfunc:`PyUFunc_RegisterLoopForType` for user-defined types). A + signature is an array of data-type numbers indicating the inputs + followed by the outputs assumed by the 1-d loop. + +.. cfunction:: int PyUFunc_GenericFunction(PyUFuncObject* self, PyObject* args, PyArrayObject** mps) + + A generic ufunc call. The ufunc is passed in as *self*, the + arguments to the ufunc as *args*. The *mps* argument is an array + of :ctype:`PyArrayObject` pointers containing the converted input + arguments as well as the ufunc outputs on return. The user is + responsible for managing this array and receives a new reference + for each array in *mps*. The total number of arrays in *mps* is + given by *self* ->nin + *self* ->nout. + +.. cfunction:: int PyUFunc_checkfperr(int errmask, PyObject* errobj) + + A simple interface to the IEEE error-flag checking support. The + *errmask* argument is a mask of :cdata:`UFUNC_MASK_{ERR}` bitmasks + indicating which errors to check for (and how to check for + them). The *errobj* must be a Python tuple with two elements: a + string containing the name which will be used in any communication + of error and either a callable Python object (call-back function) + or :cdata:`Py_None`. The callable object will only be used if + :cdata:`UFUNC_ERR_CALL` is set as the desired error checking + method. This routine manages the GIL and is safe to call even + after releasing the GIL. If an error in the IEEE-compatibile + hardware is determined a -1 is returned, otherwise a 0 is + returned. + +.. cfunction:: void PyUFunc_clearfperr() + + Clear the IEEE error flags. + +.. cfunction:: void PyUFunc_GetPyValues(char* name, int* bufsize, int* errmask, PyObject** errobj) + + Get the Python values used for ufunc processing from the + thread-local storage area unless the defaults have been set in + which case the name lookup is bypassed. The name is placed as a + string in the first element of *\*errobj*. The second element is + the looked-up function to call on error callback. The value of the + looked-up buffer-size to use is passed into *bufsize*, and the + value of the error mask is placed into *errmask*. + + +Generic functions +----------------- + +At the core of every ufunc is a collection of type-specific functions +that defines the basic functionality for each of the supported types. +These functions must evaluate the underlying function :math:`N\geq1` +times. Extra-data may be passed in that may be used during the +calculation. This feature allows some general functions to be used as +these basic looping functions. The general function has all the code +needed to point variables to the right place and set up a function +call. The general function assumes that the actual function to call is +passed in as the extra data and calls it with the correct values. All +of these functions are suitable for placing directly in the array of +functions stored in the functions member of the PyUFuncObject +structure. + +.. cfunction:: void PyUFunc_f_f_As_d_d(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_d_d(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_f_f(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_g_g(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_F_F_As_D_D(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_F_F(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_D_D(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_G_G(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + + Type specific, core 1-d functions for ufuncs where each + calculation is obtained by calling a function taking one input + argument and returning one output. This function is passed in + ``func``. The letters correspond to dtypechar's of the supported + data types ( ``f`` - float, ``d`` - double, ``g`` - long double, + ``F`` - cfloat, ``D`` - cdouble, ``G`` - clongdouble). The + argument *func* must support the same signature. The _As_X_X + variants assume ndarray's of one data type but cast the values to + use an underlying function that takes a different data type. Thus, + :cfunc:`PyUFunc_f_f_As_d_d` uses ndarrays of data type :cdata:`NPY_FLOAT` + but calls out to a C-function that takes double and returns + double. + +.. cfunction:: void PyUFunc_ff_f_As_dd_d(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_ff_f(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_dd_d(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_gg_g(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_FF_F_As_DD_D(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_DD_D(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_FF_F(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_GG_G(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + + Type specific, core 1-d functions for ufuncs where each + calculation is obtained by calling a function taking two input + arguments and returning one output. The underlying function to + call is passed in as *func*. The letters correspond to + dtypechar's of the specific data type supported by the + general-purpose function. The argument ``func`` must support the + corresponding signature. The ``_As_XX_X`` variants assume ndarrays + of one data type but cast the values at each iteration of the loop + to use the underlying function that takes a different data type. + +.. cfunction:: void PyUFunc_O_O(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + +.. cfunction:: void PyUFunc_OO_O(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + + One-input, one-output, and two-input, one-output core 1-d functions + for the :cdata:`NPY_OBJECT` data type. These functions handle reference count + issues and return early on error. The actual function to call is *func* + and it must accept calls with the signature ``(PyObject*)(PyObject*)`` + for :cfunc:`PyUFunc_O_O` or ``(PyObject*)(PyObject *, PyObject *)`` + for :cfunc:`PyUFunc_OO_O`. + +.. cfunction:: void PyUFunc_O_O_method(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + + This general purpose 1-d core function assumes that *func* is a string + representing a method of the input object. For each + iteration of the loop, the Python obejct is extracted from the array + and its *func* method is called returning the result to the output array. + +.. cfunction:: void PyUFunc_OO_O_method(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + + This general purpose 1-d core function assumes that *func* is a + string representing a method of the input object that takes one + argument. The first argument in *args* is the method whose function is + called, the second argument in *args* is the argument passed to the + function. The output of the function is stored in the third entry + of *args*. + +.. cfunction:: void PyUFunc_On_Om(char** args, npy_intp* dimensions, npy_intp* steps, void* func) + + This is the 1-d core function used by the dynamic ufuncs created + by umath.frompyfunc(function, nin, nout). In this case *func* is a + pointer to a :ctype:`PyUFunc_PyFuncData` structure which has definition + + .. ctype:: PyUFunc_PyFuncData + + .. code-block:: c + + typedef struct { + int nin; + int nout; + PyObject *callable; + } PyUFunc_PyFuncData; + + At each iteration of the loop, the *nin* input objects are exctracted + from their object arrays and placed into an argument tuple, the Python + *callable* is called with the input arguments, and the nout + outputs are placed into their object arrays. + + +Importing the API +----------------- + +.. cvar:: PY_UFUNC_UNIQUE_SYMBOL + +.. cvar:: NO_IMPORT_UFUNC + +.. cfunction:: void import_ufunc(void) + + These are the constants and functions for accessing the ufunc + C-API from extension modules in precisely the same way as the + array C-API can be accessed. The ``import_ufunc`` () function must + always be called (in the initialization subroutine of the + extension module). If your extension module is in one file then + that is all that is required. The other two constants are useful + if your extension module makes use of multiple files. In that + case, define :cdata:`PY_UFUNC_UNIQUE_SYMBOL` to something unique to + your code and then in source files that do not contain the module + initialization function but still need access to the UFUNC API, + define :cdata:`PY_UFUNC_UNIQUE_SYMBOL` to the same name used previously + and also define :cdata:`NO_IMPORT_UFUNC`. + + The C-API is actually an array of function pointers. This array is + created (and pointed to by a global variable) by import_ufunc. The + global variable is either statically defined or allowed to be seen + by other files depending on the state of + :cdata:`Py_UFUNC_UNIQUE_SYMBOL` and :cdata:`NO_IMPORT_UFUNC`. + +.. index:: + pair: ufunc; C-API Added: numpy-docs/trunk/source/reference/distutils.rst =================================================================== --- numpy-docs/trunk/source/reference/distutils.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/distutils.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,413 @@ +********************************** +Packaging (:mod:`numpy.distutils`) +********************************** + +.. module:: numpy.distutils + +NumPy provides enhanced distutils functionality to make it easier to +build and install sub-packages, auto-generate code, and extension +modules that use Fortran-compiled libraries. To use features of numpy +distutils, use the :func:`setup ` command from +:mod:`numpy.distutils.core`. A useful :class:`Configuration +` class is also provided in +:mod:`numpy.distutils.misc_util` that can make it easier to construct +keyword arguments to pass to the setup function (by passing the +dictionary obtained from the todict() method of the class). More +information is available in the NumPy Distutils Users Guide in +``/numpy/doc/DISTUTILS.txt``. + +.. index:: + single: distutils + + +Modules in :mod:`numpy.distutils` +================================= + +misc_util +--------- + +.. module:: numpy.distutils.misc_util + +.. autosummary:: + :toctree: generated/ + + Configuration + get_numpy_include_dirs + get_numarray_include_dirs + dict_append + appendpath + allpath + dot_join + generate_config_py + get_cmd + terminal_has_colors + red_text + green_text + yellow_text + blue_text + cyan_text + cyg2win32 + all_strings + has_f_sources + has_cxx_sources + filter_sources + get_dependencies + is_local_src_dir + get_ext_source_files + get_script_files + + +.. class:: Configuration(package_name=None, parent_name=None, top_path=None, package_path=None, **attrs) + + Construct a configuration instance for the given package name. If + *parent_name* is not :const:`None`, then construct the package as a + sub-package of the *parent_name* package. If *top_path* and + *package_path* are :const:`None` then they are assumed equal to + the path of the file this instance was created in. The setup.py + files in the numpy distribution are good examples of how to use + the :class:`Configuration` instance. + + .. method:: todict() + + Return a dictionary compatible with the keyword arguments of distutils + setup function. Thus, this method may be used as + setup(\**config.todict()). + + .. method:: get_distribution() + + Return the distutils distribution object for self. + + .. method:: get_subpackage(subpackage_name, subpackage_path=None) + + Return a Configuration instance for the sub-package given. If + subpackage_path is None then the path is assumed to be the local path + plus the subpackage_name. If a setup.py file is not found in the + subpackage_path, then a default configuration is used. + + .. method:: add_subpackage(subpackage_name, subpackage_path=None) + + Add a sub-package to the current Configuration instance. This is + useful in a setup.py script for adding sub-packages to a package. The + sub-package is contained in subpackage_path / subpackage_name and this + directory may contain a setup.py script or else a default setup + (suitable for Python-code-only subpackages) is assumed. If the + subpackage_path is None, then it is assumed to be located in the local + path / subpackage_name. + + .. method:: self.add_data_files(*files) + + Add files to the list of data_files to be included with the package. + The form of each element of the files sequence is very flexible + allowing many combinations of where to get the files from the package + and where they should ultimately be installed on the system. The most + basic usage is for an element of the files argument sequence to be a + simple filename. This will cause that file from the local path to be + installed to the installation path of the self.name package (package + path). The file argument can also be a relative path in which case the + entire relative path will be installed into the package directory. + Finally, the file can be an absolute path name in which case the file + will be found at the absolute path name but installed to the package + path. + + This basic behavior can be augmented by passing a 2-tuple in as the + file argument. The first element of the tuple should specify the + relative path (under the package install directory) where the + remaining sequence of files should be installed to (it has nothing to + do with the file-names in the source distribution). The second element + of the tuple is the sequence of files that should be installed. The + files in this sequence can be filenames, relative paths, or absolute + paths. For absolute paths the file will be installed in the top-level + package installation directory (regardless of the first argument). + Filenames and relative path names will be installed in the package + install directory under the path name given as the first element of + the tuple. An example may clarify:: + + self.add_data_files('foo.dat', + ('fun', ['gun.dat', 'nun/pun.dat', '/tmp/sun.dat']), + 'bar/cat.dat', + '/full/path/to/can.dat') + + will install these data files to:: + + / + foo.dat + fun/ + gun.dat + nun/ + pun.dat + sun.dat + bar/ + car.dat + can.dat + + where is the package (or sub-package) + directory such as '/usr/lib/python2.4/site-packages/mypackage' ('C: \\Python2.4 \\Lib \\site-packages \\mypackage') or '/usr/lib/python2.4/site- + packages/mypackage/mysubpackage' ('C: \\Python2.4 \\Lib \\site-packages \\mypackage \\mysubpackage'). + + + An additional feature is that the path to a data-file can actually be + a function that takes no arguments and returns the actual path(s) to + the data-files. This is useful when the data files are generated while + building the package. + + .. method:: add_data_dir(data_path) + + Recursively add files under data_path to the list of data_files to be + installed (and distributed). The data_path can be either a relative + path-name, or an absolute path-name, or a 2-tuple where the first + argument shows where in the install directory the data directory + should be installed to. For example suppose the source directory + contains fun/foo.dat and fun/bar/car.dat:: + + self.add_data_dir('fun') + self.add_data_dir(('sun', 'fun')) + self.add_data_dir(('gun', '/full/path/to/fun')) + + Will install data-files to the locations:: + + / + fun/ + foo.dat + bar/ + car.dat + sun/ + foo.dat + bar/ + car.dat + gun/ + foo.dat + car.dat + + .. method:: add_include_dirs(*paths) + + Add the given sequence of paths to the beginning of the include_dirs + list. This list will be visible to all extension modules of the + current package. + + .. method:: add_headers(*files) + + Add the given sequence of files to the beginning of the headers list. + By default, headers will be installed under // directory. If an item of files + is a tuple, then its first argument specifies the actual installation + location relative to the path. + + .. method:: add_extension(name, sources, **kw) + + Create and add an Extension instance to the ext_modules list. The + first argument defines the name of the extension module that will be + installed under the self.name package. The second argument is a list + of sources. This method also takes the following optional keyword + arguments that are passed on to the Extension constructor: + include_dirs, define_macros, undef_macros, library_dirs, libraries, + runtime_library_dirs, extra_objects, swig_opts, depends, language, + f2py_options, module_dirs, and extra_info. + + The self.paths(...) method is applied to all lists that may contain + paths. The extra_info is a dictionary or a list of dictionaries whose + content will be appended to the keyword arguments. The depends list + contains paths to files or directories that the sources of the + extension module depend on. If any path in the depends list is newer + than the extension module, then the module will be rebuilt. + + The list of sources may contain functions (called source generators) + which must take an extension instance and a build directory as inputs + and return a source file or list of source files or None. If None is + returned then no sources are generated. If the Extension instance has + no sources after processing all source generators, then no extension + module is built. + + .. method:: add_library(name, sources, **build_info) + + Add a library to the list of libraries. Allowed keyword arguments are + depends, macros, include_dirs, extra_compiler_args, and f2py_options. + The name is the name of the library to be built and sources is a list + of sources (or source generating functions) to add to the library. + + .. method:: add_scripts(*files) + + Add the sequence of files to the beginning of the scripts list. + Scripts will be installed under the /bin/ directory. + + .. method:: paths(*paths) + + Applies glob.glob(...) to each path in the sequence (if needed) and + pre-pends the local_path if needed. Because this is called on all + source lists, this allows wildcard characters to be specified in lists + of sources for extension modules and libraries and scripts and allows + path-names be relative to the source directory. + + .. method:: get_config_cmd() + + Returns the numpy.distutils config command instance. + + .. method:: get_build_temp_dir() + + Return a path to a temporary directory where temporary files should be + placed. + + .. method:: have_f77c() + + True if a Fortran 77 compiler is available (because a simple Fortran + 77 code was able to be compiled successfully). + + .. method:: have_f90c() + + True if a Fortran 90 compiler is available (because a simple Fortran + 90 code was able to be compiled successfully) + + .. method:: get_version() + + Return a version string of the current package or None if the version + information could not be detected. This method scans files named + __version__.py, _version.py, version.py, and + __svn_version__.py for string variables version, __version\__, and + _version, until a version number is found. + + .. method:: make_svn_version_py() + + Appends a data function to the data_files list that will generate + __svn_version__.py file to the current package directory. This file + will be removed from the source directory when Python exits (so that + it can be re-generated next time the package is built). This is + intended for working with source directories that are in an SVN + repository. + + .. method:: make_config_py() + + Generate a package __config__.py file containing system information + used during the building of the package. This file is installed to the + package installation directory. + + .. method:: get_info(*names) + + Return information (from system_info.get_info) for all of the names in + the argument list in a single dictionary. + + +Other modules +------------- + +.. currentmodule:: numpy.distutils + +.. autosummary:: + :toctree: generated/ + + system_info.get_info + system_info.get_standard_file + cpuinfo.cpu + log.set_verbosity + exec_command + + +Conversion of ``.src`` files +============================ + +NumPy distutils supports automatic conversion of source files named +.src. This facility can be used to maintain very similar +code blocks requiring only simple changes between blocks. During the +build phase of setup, if a template file named .src is +encountered, a new file named is constructed from the +template and placed in the build directory to be used instead. Two +forms of template conversion are supported. The first form occurs for +files named named .ext.src where ext is a recognized Fortran +extension (f, f90, f95, f77, for, ftn, pyf). The second form is used +for all other cases. + +.. index:: + single: code generation + +Fortran files +------------- + +This template converter will replicate all **function** and +**subroutine** blocks in the file with names that contain '<...>' +according to the rules in '<...>'. The number of comma-separated words +in '<...>' determines the number of times the block is repeated. What +these words are indicates what that repeat rule, '<...>', should be +replaced with in each block. All of the repeat rules in a block must +contain the same number of comma-separated words indicating the number +of times that block should be repeated. If the word in the repeat rule +needs a comma, leftarrow, or rightarrow, then prepend it with a +backslash ' \'. If a word in the repeat rule matches ' \\' then +it will be replaced with the -th word in the same repeat +specification. There are two forms for the repeat rule: named and +short. + + +Named repeat rule +^^^^^^^^^^^^^^^^^ + +A named repeat rule is useful when the same set of repeats must be +used several times in a block. It is specified using , where N is the number of times the block +should be repeated. On each repeat of the block, the entire +expression, '<...>' will be replaced first with item1, and then with +item2, and so forth until N repeats are accomplished. Once a named +repeat specification has been introduced, the same repeat rule may be +used **in the current block** by referring only to the name +(i.e. . + + +Short repeat rule +^^^^^^^^^^^^^^^^^ + +A short repeat rule looks like . The +rule specifies that the entire expression, '<...>' should be replaced +first with item1, and then with item2, and so forth until N repeats +are accomplished. + + +Pre-defined names +^^^^^^^^^^^^^^^^^ + +The following predefined named repeat rules are available: + +- + +- <_c=s,d,c,z> + +- <_t=real, double precision, complex, double complex> + +- + +- + +- + +- + + +Other files +----------- + +Non-Fortran files use a separate syntax for defining template blocks +that should be repeated using a variable expansion similar to the +named repeat rules of the Fortran-specific repeats. The template rules +for these files are: + +1. "/\**begin repeat "on a line by itself marks the beginning of + a segment that should be repeated. + +2. Named variable expansions are defined using #name=item1, item2, item3, + ..., itemN# and placed on successive lines. These variables are + replaced in each repeat block with corresponding word. All named + variables in the same repeat block must define the same number of + words. + +3. In specifying the repeat rule for a named variable, item*N is short- + hand for item, item, ..., item repeated N times. In addition, + parenthesis in combination with \*N can be used for grouping several + items that should be repeated. Thus, #name=(item1, item2)*4# is + equivalent to #name=item1, item2, item1, item2, item1, item2, item1, + item2# + +4. "\*/ "on a line by itself marks the end of the the variable expansion + naming. The next line is the first line that will be repeated using + the named rules. + +5. Inside the block to be repeated, the variables that should be expanded + are specified as @name at . + +6. "/\**end repeat**/ "on a line by itself marks the previous line + as the last line of the block to be repeated. Added: numpy-docs/trunk/source/reference/figures/dtype-hierarchy.dia =================================================================== (Binary files differ) Property changes on: numpy-docs/trunk/source/reference/figures/dtype-hierarchy.dia ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: numpy-docs/trunk/source/reference/figures/dtype-hierarchy.pdf =================================================================== (Binary files differ) Property changes on: numpy-docs/trunk/source/reference/figures/dtype-hierarchy.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: numpy-docs/trunk/source/reference/figures/dtype-hierarchy.png =================================================================== (Binary files differ) Property changes on: numpy-docs/trunk/source/reference/figures/dtype-hierarchy.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: numpy-docs/trunk/source/reference/figures/threefundamental.fig =================================================================== --- numpy-docs/trunk/source/reference/figures/threefundamental.fig 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/figures/threefundamental.fig 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,57 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +6 1950 2850 4350 3450 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 1950 2850 4350 2850 4350 3450 1950 3450 1950 2850 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 2550 2850 2550 3450 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 3150 2850 3150 3450 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 3750 2850 3750 3450 +-6 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 5100 2850 7500 2850 7500 3450 5100 3450 5100 2850 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 5700 2850 5700 3450 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 6300 2850 6300 3450 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 6900 2850 6900 3450 +2 4 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5 + 7800 3600 7800 2700 525 2700 525 3600 7800 3600 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 675 2850 1725 2850 1725 3450 675 3450 675 2850 +2 2 0 4 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 5700 2850 6300 2850 6300 3450 5700 3450 5700 2850 +2 2 0 4 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 5700 1725 6300 1725 6300 2325 5700 2325 5700 1725 +2 4 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5 + 6450 2475 6450 1275 5550 1275 5550 2475 6450 2475 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 5700 1350 6300 1350 6300 1575 5700 1575 5700 1350 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 3 + 2 1 1.00 60.00 120.00 + 900 2850 900 1875 1575 1875 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 3375 1800 5550 1800 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 6000 2850 6000 2325 +2 4 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5 + 3375 2100 3375 1575 1575 1575 1575 2100 3375 2100 +4 0 0 50 -1 18 14 0.0000 4 165 720 825 3225 header\001 +4 0 0 50 -1 2 40 0.0000 4 105 450 4500 3225 ...\001 +4 0 0 50 -1 18 14 0.0000 4 210 810 3600 3900 ndarray\001 +4 0 0 50 -1 18 14 0.0000 4 165 630 6600 2175 scalar\001 +4 0 0 50 -1 18 14 0.0000 4 165 540 6600 1950 array\001 +4 0 0 50 -1 16 12 0.0000 4 135 420 5775 1500 head\001 +4 0 0 50 -1 18 14 0.0000 4 210 975 1950 1875 data-type\001 Added: numpy-docs/trunk/source/reference/figures/threefundamental.pdf =================================================================== (Binary files differ) Property changes on: numpy-docs/trunk/source/reference/figures/threefundamental.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: numpy-docs/trunk/source/reference/figures/threefundamental.png =================================================================== (Binary files differ) Property changes on: numpy-docs/trunk/source/reference/figures/threefundamental.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: numpy-docs/trunk/source/reference/index.rst =================================================================== --- numpy-docs/trunk/source/reference/index.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/index.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,43 @@ +.. _reference: + +############### +NumPy Reference +############### + +:Release: |version| +:Date: |today| + +.. module:: numpy + +This reference manual details functions, modules, and objects +included in Numpy, describing what they are and what they do. +For learning how to use NumPy, see also :ref:`user`. + + +.. toctree:: + :maxdepth: 2 + + arrays + ufuncs + routines + ctypes + distutils + c-api + internals + + +Acknowledgements +================ + +Large parts of this manual originate from Travis E. Oliphant's book +`Guide to Numpy `__ (which generously entered +Public Domain in August 2008). The reference documentation for many of +the functions are written by numerous contributors and developers of +Numpy, both prior to and during the +`Numpy Documentation Marathon `__. + +The Documentation Marathon is still ongoing. Please help us write +better documentation for Numpy by joining it! Instructions on how to +join and what to do can be found +`on the scipy.org website `__ + Added: numpy-docs/trunk/source/reference/internals.code-explanations.rst =================================================================== --- numpy-docs/trunk/source/reference/internals.code-explanations.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/internals.code-explanations.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,665 @@ +.. currentmodule:: numpy + +************************* +Numpy C Code Explanations +************************* + + Fanaticism consists of redoubling your efforts when you have forgotten + your aim. + --- *George Santayana* + + An authority is a person who can tell you more about something than + you really care to know. + --- *Unknown* + +This Chapter attempts to explain the logic behind some of the new +pieces of code. The purpose behind these explanations is to enable +somebody to be able to understand the ideas behind the implementation +somewhat more easily than just staring at the code. Perhaps in this +way, the algorithms can be improved on, borrowed from, and/or +optimized. + + +Memory model +============ + +.. index:: + pair: ndarray; memory model + +One fundamental aspect of the ndarray is that an array is seen as a +"chunk" of memory starting at some location. The interpretation of +this memory depends on the stride information. For each dimension in +an :math:`N` -dimensional array, an integer (stride) dictates how many +bytes must be skipped to get to the next element in that dimension. +Unless you have a single-segment array, this stride information must +be consulted when traversing through an array. It is not difficult to +write code that accepts strides, you just have to use (char \*) +pointers because strides are in units of bytes. Keep in mind also that +strides do not have to be unit-multiples of the element size. Also, +remember that if the number of dimensions of the array is 0 (sometimes +called a rank-0 array), then the strides and dimensions variables are +NULL. + +Besides the structural information contained in the strides and +dimensions members of the :ctype:`PyArrayObject`, the flags contain important +information about how the data may be accessed. In particular, the +:cdata:`NPY_ALIGNED` flag is set when the memory is on a suitable boundary +according to the data-type array. Even if you have a contiguous chunk +of memory, you cannot just assume it is safe to dereference a data- +type-specific pointer to an element. Only if the :cdata:`NPY_ALIGNED` flag is +set is this a safe operation (on some platforms it will work but on +others, like Solaris, it will cause a bus error). The :cdata:`NPY_WRITEABLE` +should also be ensured if you plan on writing to the memory area of +the array. It is also possible to obtain a pointer to an unwriteable +memory area. Sometimes, writing to the memory area when the +:cdata:`NPY_WRITEABLE` flag is not set will just be rude. Other times it can +cause program crashes ( *e.g.* a data-area that is a read-only +memory-mapped file). + + +Data-type encapsulation +======================= + +.. index:: + single: dtype + +The data-type is an important abstraction of the ndarray. Operations +will look to the data-type to provide the key functionality that is +needed to operate on the array. This functionality is provided in the +list of function pointers pointed to by the 'f' member of the +:ctype:`PyArray_Descr` structure. In this way, the number of data-types can be +extended simply by providing a :ctype:`PyArray_Descr` structure with suitable +function pointers in the 'f' member. For built-in types there are some +optimizations that by-pass this mechanism, but the point of the data- +type abstraction is to allow new data-types to be added. + +One of the built-in data-types, the void data-type allows for +arbitrary records containing 1 or more fields as elements of the +array. A field is simply another data-type object along with an offset +into the current record. In order to support arbitrarily nested +fields, several recursive implementations of data-type access are +implemented for the void type. A common idiom is to cycle through the +elements of the dictionary and perform a specific operation based on +the data-type object stored at the given offset. These offsets can be +arbitrary numbers. Therefore, the possibility of encountering mis- +aligned data must be recognized and taken into account if necessary. + + +N-D Iterators +============= + +.. index:: + single: array iterator + +A very common operation in much of NumPy code is the need to iterate +over all the elements of a general, strided, N-dimensional array. This +operation of a general-purpose N-dimensional loop is abstracted in the +notion of an iterator object. To write an N-dimensional loop, you only +have to create an iterator object from an ndarray, work with the +dataptr member of the iterator object structure and call the macro +:cfunc:`PyArray_ITER_NEXT` (it) on the iterator object to move to the next +element. The "next" element is always in C-contiguous order. The macro +works by first special casing the C-contiguous, 1-d, and 2-d cases +which work very simply. + +For the general case, the iteration works by keeping track of a list +of coordinate counters in the iterator object. At each iteration, the +last coordinate counter is increased (starting from 0). If this +counter is smaller then one less than the size of the array in that +dimension (a pre-computed and stored value), then the counter is +increased and the dataptr member is increased by the strides in that +dimension and the macro ends. If the end of a dimension is reached, +the counter for the last dimension is reset to zero and the dataptr is +moved back to the beginning of that dimension by subtracting the +strides value times one less than the number of elements in that +dimension (this is also pre-computed and stored in the backstrides +member of the iterator object). In this case, the macro does not end, +but a local dimension counter is decremented so that the next-to-last +dimension replaces the role that the last dimension played and the +previously-described tests are executed again on the next-to-last +dimension. In this way, the dataptr is adjusted appropriately for +arbitrary striding. + +The coordinates member of the :ctype:`PyArrayIterObject` structure maintains +the current N-d counter unless the underlying array is C-contiguous in +which case the coordinate counting is by-passed. The index member of +the :ctype:`PyArrayIterObject` keeps track of the current flat index of the +iterator. It is updated by the :cfunc:`PyArray_ITER_NEXT` macro. + + +Broadcasting +============ + +.. index:: + single: broadcasting + +In Numeric, broadcasting was implemented in several lines of code +buried deep in ufuncobject.c. In NumPy, the notion of broadcasting has +been abstracted so that it can be performed in multiple places. +Broadcasting is handled by the function :cfunc:`PyArray_Broadcast`. This +function requires a :ctype:`PyArrayMultiIterObject` (or something that is a +binary equivalent) to be passed in. The :ctype:`PyArrayMultiIterObject` keeps +track of the broadcasted number of dimensions and size in each +dimension along with the total size of the broadcasted result. It also +keeps track of the number of arrays being broadcast and a pointer to +an iterator for each of the arrays being broadcasted. + +The :cfunc:`PyArray_Broadcast` function takes the iterators that have already +been defined and uses them to determine the broadcast shape in each +dimension (to create the iterators at the same time that broadcasting +occurs then use the :cfunc:`PyMultiIter_New` function). Then, the iterators are +adjusted so that each iterator thinks it is iterating over an array +with the broadcasted size. This is done by adjusting the iterators +number of dimensions, and the shape in each dimension. This works +because the iterator strides are also adjusted. Broadcasting only +adjusts (or adds) length-1 dimensions. For these dimensions, the +strides variable is simply set to 0 so that the data-pointer for the +iterator over that array doesn't move as the broadcasting operation +operates over the extended dimension. + +Broadcasting was always implemented in Numeric using 0-valued strides +for the extended dimensions. It is done in exactly the same way in +NumPy. The big difference is that now the array of strides is kept +track of in a :ctype:`PyArrayIterObject`, the iterators involved in a +broadcasted result are kept track of in a :ctype:`PyArrayMultiIterObject`, +and the :cfunc:`PyArray_BroadCast` call implements the broad-casting rules. + + +Array Scalars +============= + +.. index:: + single: array scalars + +The array scalars offer a hierarchy of Python types that allow a one- +to-one correspondence between the data-type stored in an array and the +Python-type that is returned when an element is extracted from the +array. An exception to this rule was made with object arrays. Object +arrays are heterogeneous collections of arbitrary Python objects. When +you select an item from an object array, you get back the original +Python object (and not an object array scalar which does exist but is +rarely used for practical purposes). + +The array scalars also offer the same methods and attributes as arrays +with the intent that the same code can be used to support arbitrary +dimensions (including 0-dimensions). The array scalars are read-only +(immutable) with the exception of the void scalar which can also be +written to so that record-array field setting works more naturally +(a[0]['f1'] = ``value`` ). + + +Advanced ("Fancy") Indexing +============================= + +.. index:: + single: indexing + +The implementation of advanced indexing represents some of the most +difficult code to write and explain. In fact, there are two +implementations of advanced indexing. The first works only with 1-d +arrays and is implemented to handle expressions involving a.flat[obj]. +The second is general-purpose that works for arrays of "arbitrary +dimension" (up to a fixed maximum). The one-dimensional indexing +approaches were implemented in a rather straightforward fashion, and +so it is the general-purpose indexing code that will be the focus of +this section. + +There is a multi-layer approach to indexing because the indexing code +can at times return an array scalar and at other times return an +array. The functions with "_nice" appended to their name do this +special handling while the function without the _nice appendage always +return an array (perhaps a 0-dimensional array). Some special-case +optimizations (the index being an integer scalar, and the index being +a tuple with as many dimensions as the array) are handled in +array_subscript_nice function which is what Python calls when +presented with the code "a[obj]." These optimizations allow fast +single-integer indexing, and also ensure that a 0-dimensional array is +not created only to be discarded as the array scalar is returned +instead. This provides significant speed-up for code that is selecting +many scalars out of an array (such as in a loop). However, it is still +not faster than simply using a list to store standard Python scalars, +because that is optimized by the Python interpreter itself. + +After these optimizations, the array_subscript function itself is +called. This function first checks for field selection which occurs +when a string is passed as the indexing object. Then, 0-d arrays are +given special-case consideration. Finally, the code determines whether +or not advanced, or fancy, indexing needs to be performed. If fancy +indexing is not needed, then standard view-based indexing is performed +using code borrowed from Numeric which parses the indexing object and +returns the offset into the data-buffer and the dimensions necessary +to create a new view of the array. The strides are also changed by +multiplying each stride by the step-size requested along the +corresponding dimension. + + +Fancy-indexing check +-------------------- + +The fancy_indexing_check routine determines whether or not to use +standard view-based indexing or new copy-based indexing. If the +indexing object is a tuple, then view-based indexing is assumed by +default. Only if the tuple contains an array object or a sequence +object is fancy-indexing assumed. If the indexing object is an array, +then fancy indexing is automatically assumed. If the indexing object +is any other kind of sequence, then fancy-indexing is assumed by +default. This is over-ridden to simple indexing if the sequence +contains any slice, newaxis, or Ellipsis objects, and no arrays or +additional sequences are also contained in the sequence. The purpose +of this is to allow the construction of "slicing" sequences which is a +common technique for building up code that works in arbitrary numbers +of dimensions. + + +Fancy-indexing implementation +----------------------------- + +The concept of indexing was also abstracted using the idea of an +iterator. If fancy indexing is performed, then a :ctype:`PyArrayMapIterObject` +is created. This internal object is not exposed to Python. It is +created in order to handle the fancy-indexing at a high-level. Both +get and set fancy-indexing operations are implemented using this +object. Fancy indexing is abstracted into three separate operations: +(1) creating the :ctype:`PyArrayMapIterObject` from the indexing object, (2) +binding the :ctype:`PyArrayMapIterObject` to the array being indexed, and (3) +getting (or setting) the items determined by the indexing object. +There is an optimization implemented so that the :ctype:`PyArrayIterObject` +(which has it's own less complicated fancy-indexing) is used for +indexing when possible. + + +Creating the mapping object +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The first step is to convert the indexing objects into a standard form +where iterators are created for all of the index array inputs and all +Boolean arrays are converted to equivalent integer index arrays (as if +nonzero(arr) had been called). Finally, all integer arrays are +replaced with the integer 0 in the indexing object and all of the +index-array iterators are "broadcast" to the same shape. + + +Binding the mapping object +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When the mapping object is created it does not know which array it +will be used with so once the index iterators are constructed during +mapping-object creation, the next step is to associate these iterators +with a particular ndarray. This process interprets any ellipsis and +slice objects so that the index arrays are associated with the +appropriate axis (the axis indicated by the iteraxis entry +corresponding to the iterator for the integer index array). This +information is then used to check the indices to be sure they are +within range of the shape of the array being indexed. The presence of +ellipsis and/or slice objects implies a sub-space iteration that is +accomplished by extracting a sub-space view of the array (using the +index object resulting from replacing all the integer index arrays +with 0) and storing the information about where this sub-space starts +in the mapping object. This is used later during mapping-object +iteration to select the correct elements from the underlying array. + + +Getting (or Setting) +^^^^^^^^^^^^^^^^^^^^ + +After the mapping object is successfully bound to a particular array, +the mapping object contains the shape of the resulting item as well as +iterator objects that will walk through the currently-bound array and +either get or set its elements as needed. The walk is implemented +using the :cfunc:`PyArray_MapIterNext` function. This function sets the +coordinates of an iterator object into the current array to be the +next coordinate location indicated by all of the indexing-object +iterators while adjusting, if necessary, for the presence of a sub- +space. The result of this function is that the dataptr member of the +mapping object structure is pointed to the next position in the array +that needs to be copied out or set to some value. + +When advanced indexing is used to extract an array, an iterator for +the new array is constructed and advanced in phase with the mapping +object iterator. When advanced indexing is used to place values in an +array, a special "broadcasted" iterator is constructed from the object +being placed into the array so that it will only work if the values +used for setting have a shape that is "broadcastable" to the shape +implied by the indexing object. + + +Universal Functions +=================== + +.. index:: + single: ufunc + +Universal functions are callable objects that take :math:`N` inputs +and produce :math:`M` outputs by wrapping basic 1-d loops that work +element-by-element into full easy-to use functions that seamlessly +implement broadcasting, type-checking and buffered coercion, and +output-argument handling. New universal functions are normally created +in C, although there is a mechanism for creating ufuncs from Python +functions (:func:`frompyfunc`). The user must supply a 1-d loop that +implements the basic function taking the input scalar values and +placing the resulting scalars into the appropriate output slots as +explaine n implementation. + + +Setup +----- + +Every ufunc calculation involves some overhead related to setting up +the calculation. The practical significance of this overhead is that +even though the actual calculation of the ufunc is very fast, you will +be able to write array and type-specific code that will work faster +for small arrays than the ufunc. In particular, using ufuncs to +perform many calculations on 0-d arrays will be slower than other +Python-based solutions (the silently-imported scalarmath module exists +precisely to give array scalars the look-and-feel of ufunc-based +calculations with significantly reduced overhead). + +When a ufunc is called, many things must be done. The information +collected from these setup operations is stored in a loop-object. This +loop object is a C-structure (that could become a Python object but is +not initialized as such because it is only used internally). This loop +object has the layout needed to be used with PyArray_Broadcast so that +the broadcasting can be handled in the same way as it is handled in +other sections of code. + +The first thing done is to look-up in the thread-specific global +dictionary the current values for the buffer-size, the error mask, and +the associated error object. The state of the error mask controls what +happens when an error-condiction is found. It should be noted that +checking of the hardware error flags is only performed after each 1-d +loop is executed. This means that if the input and output arrays are +contiguous and of the correct type so that a single 1-d loop is +performed, then the flags may not be checked until all elements of the +array have been calcluated. Looking up these values in a thread- +specific dictionary takes time which is easily ignored for all but +very small arrays. + +After checking, the thread-specific global variables, the inputs are +evaluated to determine how the ufunc should proceed and the input and +output arrays are constructed if necessary. Any inputs which are not +arrays are converted to arrays (using context if necessary). Which of +the inputs are scalars (and therefore converted to 0-d arrays) is +noted. + +Next, an appropriate 1-d loop is selected from the 1-d loops available +to the ufunc based on the input array types. This 1-d loop is selected +by trying to match the signature of the data-types of the inputs +against the available signatures. The signatures corresponding to +built-in types are stored in the types member of the ufunc structure. +The signatures corresponding to user-defined types are stored in a +linked-list of function-information with the head element stored as a +``CObject`` in the userloops dictionary keyed by the data-type number +(the first user-defined type in the argument list is used as the key). +The signatures are searched until a signature is found to which the +input arrays can all be cast safely (ignoring any scalar arguments +which are not allowed to determine the type of the result). The +implication of this search procedure is that "lesser types" should be +placed below "larger types" when the signatures are stored. If no 1-d +loop is found, then an error is reported. Otherwise, the argument_list +is updated with the stored signature --- in case casting is necessary +and to fix the output types assumed by the 1-d loop. + +If the ufunc has 2 inputs and 1 output and the second input is an +Object array then a special-case check is performed so that +NotImplemented is returned if the second input is not an ndarray, has +the __array_priority\__ attribute, and has an __r{op}\__ special +method. In this way, Python is signaled to give the other object a +chance to complete the operation instead of using generic object-array +calculations. This allows (for example) sparse matrices to override +the multiplication operator 1-d loop. + +For input arrays that are smaller than the specified buffer size, +copies are made of all non-contiguous, mis-aligned, or out-of- +byteorder arrays to ensure that for small arrays, a single-loop is +used. Then, array iterators are created for all the input arrays and +the resulting collection of iterators is broadcast to a single shape. + +The output arguments (if any) are then processed and any missing +return arrays are constructed. If any provided output array doesn't +have the correct type (or is mis-aligned) and is smaller than the +buffer size, then a new output array is constructed with the special +UPDATEIFCOPY flag set so that when it is DECREF'd on completion of the +function, it's contents will be copied back into the output array. +Iterators for the output arguments are then processed. + +Finally, the decision is made about how to execute the looping +mechanism to ensure that all elements of the input arrays are combined +to produce the output arrays of the correct type. The options for loop +execution are one-loop (for contiguous, aligned, and correct data- +type), strided-loop (for non-contiguous but still aligned and correct +data-type), and a buffered loop (for mis-aligned or incorrect data- +type situations). Depending on which execution method is called for, +the loop is then setup and computed. + + +Function call +------------- + +This section describes how the basic universal function computation +loop is setup and executed for each of the three different kinds of +execution possibilities. If :cdata:`NPY_ALLOW_THREADS` is defined during +compilation, then the Python Global Interpreter Lock (GIL) is released +prior to calling all of these loops (as long as they don't involve +object arrays). It is re-acquired if necessary to handle error +conditions. The hardware error flags are checked only after the 1-d +loop is calcluated. + + +One Loop +^^^^^^^^ + +This is the simplest case of all. The ufunc is executed by calling the +underlying 1-d loop exactly once. This is possible only when we have +aligned data of the correct type (including byte-order) for both input +and output and all arrays have uniform strides (either contiguous, +0-d, or 1-d). In this case, the 1-d computational loop is called once +to compute the calculation for the entire array. Note that the +hardware error flags are only checked after the entire calculation is +complete. + + +Strided Loop +^^^^^^^^^^^^ + +When the input and output arrays are aligned and of the correct type, +but the striding is not uniform (non-contiguous and 2-d or larger), +then a second looping structure is employed for the calculation. This +approach converts all of the iterators for the input and output +arguments to iterate over all but the largest dimension. The inner +loop is then handled by the underlying 1-d computational loop. The +outer loop is a standard iterator loop on the converted iterators. The +hardware error flags are checked after each 1-d loop is completed. + + +Buffered Loop +^^^^^^^^^^^^^ + +This is the code that handles the situation whenever the input and/or +output arrays are either misaligned or of the wrong data-type +(including being byte-swapped) from what the underlying 1-d loop +expects. The arrays are also assumed to be non-contiguous. The code +works very much like the strided loop except for the inner 1-d loop is +modified so that pre-processing is performed on the inputs and post- +processing is performed on the outputs in bufsize chunks (where +bufsize is a user-settable parameter). The underlying 1-d +computational loop is called on data that is copied over (if it needs +to be). The setup code and the loop code is considerably more +complicated in this case because it has to handle: + +- memory allocation of the temporary buffers + +- deciding whether or not to use buffers on the input and output data + (mis-aligned and/or wrong data-type) + +- copying and possibly casting data for any inputs or outputs for which + buffers are necessary. + +- special-casing Object arrays so that reference counts are properly + handled when copies and/or casts are necessary. + +- breaking up the inner 1-d loop into bufsize chunks (with a possible + remainder). + +Again, the hardware error flags are checked at the end of each 1-d +loop. + + +Final output manipulation +------------------------- + +Ufuncs allow other array-like classes to be passed seamlessly through +the interface in that inputs of a particular class will induce the +outputs to be of that same class. The mechanism by which this works is +the following. If any of the inputs are not ndarrays and define the +:obj:`__array_wrap__` method, then the class with the largest +:obj:`__array_priority__` attribute determines the type of all the +outputs (with the exception of any output arrays passed in). The +:obj:`__array_wrap__` method of the input array will be called with the +ndarray being returned from the ufunc as it's input. There are two +calling styles of the :obj:`__array_wrap__` function supported. The first +takes the ndarray as the first argument and a tuple of "context" as +the second argument. The context is (ufunc, arguments, output argument +number). This is the first call tried. If a TypeError occurs, then the +function is called with just the ndarray as the first argument. + + +Methods +------- + +Their are three methods of ufuncs that require calculation similar to +the general-purpose ufuncs. These are reduce, accumulate, and +reduceat. Each of these methods requires a setup command followed by a +loop. There are four loop styles possible for the methods +corresponding to no-elements, one-element, strided-loop, and buffered- +loop. These are the same basic loop styles as implemented for the +general purpose function call except for the no-element and one- +element cases which are special-cases occurring when the input array +objects have 0 and 1 elements respectively. + + +Setup +^^^^^ + +The setup function for all three methods is ``construct_reduce``. +This function creates a reducing loop object and fills it with +parameters needed to complete the loop. All of the methods only work +on ufuncs that take 2-inputs and return 1 output. Therefore, the +underlying 1-d loop is selected assuming a signature of [ ``otype``, +``otype``, ``otype`` ] where ``otype`` is the requested reduction +data-type. The buffer size and error handling is then retrieved from +(per-thread) global storage. For small arrays that are mis-aligned or +have incorrect data-type, a copy is made so that the un-buffered +section of code is used. Then, the looping strategy is selected. If +there is 1 element or 0 elements in the array, then a simple looping +method is selected. If the array is not mis-aligned and has the +correct data-type, then strided looping is selected. Otherwise, +buffered looping must be performed. Looping parameters are then +established, and the return array is constructed. The output array is +of a different shape depending on whether the method is reduce, +accumulate, or reduceat. If an output array is already provided, then +it's shape is checked. If the output array is not C-contiguous, +aligned, and of the correct data type, then a temporary copy is made +with the UPDATEIFCOPY flag set. In this way, the methods will be able +to work with a well-behaved output array but the result will be copied +back into the true output array when the method computation is +complete. Finally, iterators are set up to loop over the correct axis +(depending on the value of axis provided to the method) and the setup +routine returns to the actual computation routine. + + +Reduce +^^^^^^ + +.. index:: + triple: ufunc; methods; reduce + +All of the ufunc methods use the same underlying 1-d computational +loops with input and output arguments adjusted so that the appropriate +reduction takes place. For example, the key to the functioning of +reduce is that the 1-d loop is called with the output and the second +input pointing to the same position in memory and both having a step- +size of 0. The first input is pointing to the input array with a step- +size given by the appropriate stride for the selected axis. In this +way, the operation performed is + +.. math:: + :nowrap: + + \begin{align*} + o & = & i[0] \\ + o & = & i[k]\textrm{}o\quad k=1\ldots N + \end{align*} + +where :math:`N+1` is the number of elements in the input, :math:`i`, +:math:`o` is the output, and :math:`i[k]` is the +:math:`k^{\textrm{th}}` element of :math:`i` along the selected axis. +This basic operations is repeated for arrays with greater than 1 +dimension so that the reduction takes place for every 1-d sub-array +along the selected axis. An iterator with the selected dimension +removed handles this looping. + +For buffered loops, care must be taken to copy and cast data before +the loop function is called because the underlying loop expects +aligned data of the correct data-type (including byte-order). The +buffered loop must handle this copying and casting prior to calling +the loop function on chunks no greater than the user-specified +bufsize. + + +Accumulate +^^^^^^^^^^ + +.. index:: + triple: ufunc; methods; accumulate + +The accumulate function is very similar to the reduce function in that +the output and the second input both point to the output. The +difference is that the second input points to memory one stride behind +the current output pointer. Thus, the operation performed is + +.. math:: + :nowrap: + + \begin{align*} + o[0] & = & i[0] \\ + o[k] & = & i[k]\textrm{}o[k-1]\quad k=1\ldots N. + \end{align*} + +The output has the same shape as the input and each 1-d loop operates +over :math:`N` elements when the shape in the selected axis is :math:`N+1`. Again, buffered loops take care to copy and cast the data before +calling the underlying 1-d computational loop. + + +Reduceat +^^^^^^^^ + +.. index:: + triple: ufunc; methods; reduceat + single: ufunc + +The reduceat function is a generalization of both the reduce and +accumulate functions. It implements a reduce over ranges of the input +array specified by indices. The extra indices argument is checked to +be sure that every input is not too large for the input array along +the selected dimension before the loop calculations take place. The +loop implementation is handled using code that is very similar to the +reduce code repeated as many times as there are elements in the +indices input. In particular: the first input pointer passed to the +underlying 1-d computational loop points to the input array at the +correct location indicated by the index array. In addition, the output +pointer and the second input pointer passed to the underlying 1-d loop +point to the same position in memory. The size of the 1-d +computational loop is fixed to be the difference between the current +index and the next index (when the current index is the last index, +then the next index is assumed to be the length of the array along the +selected dimension). In this way, the 1-d loop will implement a reduce +over the specified indices. + +Mis-aligned or a loop data-type that does not match the input and/or +output data-type is handled using buffered code where-in data is +copied to a temporary buffer and cast to the correct data-type if +necessary prior to calling the underlying 1-d function. The temporary +buffers are created in (element) sizes no bigger than the user +settable buffer-size value. Thus, the loop must be flexible enough to +call the underlying 1-d computational loop enough times to complete +the total calculation in chunks no bigger than the buffer-size. Added: numpy-docs/trunk/source/reference/internals.rst =================================================================== --- numpy-docs/trunk/source/reference/internals.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/internals.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,9 @@ +*************** +Numpy internals +*************** + +.. toctree:: + + internals.code-explanations + +.. automodule:: numpy.doc.internals Added: numpy-docs/trunk/source/reference/routines.array-creation.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.array-creation.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.array-creation.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,98 @@ +.. _routines.array-creation: + +Array creation routines +======================= + +.. seealso:: :ref:`Array creation ` + +.. currentmodule:: numpy + +Ones and zeros +-------------- +.. autosummary:: + :toctree: generated/ + + empty + empty_like + eye + identity + ones + ones_like + zeros + zeros_like + +From existing data +------------------ +.. autosummary:: + :toctree: generated/ + + array + asarray + asanyarray + ascontiguousarray + asmatrix + copy + frombuffer + fromfile + fromfunction + fromiter + loadtxt + +.. _routines.array-creation.rec: + +Creating record arrays (:mod:`numpy.rec`) +----------------------------------------- + +.. note:: :mod:`numpy.rec` is the preferred alias for :mod:`numpy.core.records`. + +.. autosummary:: + :toctree: generated/ + + core.records.array + core.records.fromarrays + core.records.fromrecords + core.records.fromstring + core.records.fromfile + +.. _routines.array-creation.char: + +Creating character arrays (:mod:`numpy.char`) +--------------------------------------------- + +.. note:: :mod:`numpy.char` is the preferred alias for :mod:`numpy.core.defchararray`. + +.. autosummary:: + :toctree: generated/ + + core.defchararray.array + +Numerical ranges +---------------- +.. autosummary:: + :toctree: generated/ + + arange + linspace + logspace + meshgrid + mgrid + +Building matrices +----------------- +.. autosummary:: + :toctree: generated/ + + diag + diagflat + tri + tril + triu + vander + +The Matrix class +---------------- +.. autosummary:: + :toctree: generated/ + + mat + bmat Added: numpy-docs/trunk/source/reference/routines.array-manipulation.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.array-manipulation.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.array-manipulation.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,108 @@ +Array manipulation routines +*************************** + +.. currentmodule:: numpy + +.. toctree:: + +Changing array shape +==================== +.. autosummary:: + :toctree: generated/ + + + reshape + ravel + ndarray.flat + ndarray.flatten + +Transpose-like operations +========================= +.. autosummary:: + :toctree: generated/ + + + rollaxis + swapaxes + ndarray.T + transpose + +Changing number of dimensions +============================= +.. autosummary:: + :toctree: generated/ + + + atleast_1d + atleast_2d + atleast_3d + broadcast + broadcast_arrays + expand_dims + squeeze + +Changing kind of array +====================== +.. autosummary:: + :toctree: generated/ + + asarray + asanyarray + asmatrix + asfarray + asfortranarray + asscalar + require + +Joining arrays +============== +.. autosummary:: + :toctree: generated/ + + append + column_stack + concatenate + dstack + hstack + vstack + +Splitting arrays +================ +.. autosummary:: + :toctree: generated/ + + array_split + dsplit + hsplit + split + vsplit + +Tiling arrays +============= +.. autosummary:: + :toctree: generated/ + + tile + repeat + +Adding and removing elements +============================ +.. autosummary:: + :toctree: generated/ + + delete + insert + resize + trim_zeros + unique + +Rearranging elements +==================== +.. autosummary:: + :toctree: generated/ + + fliplr + flipud + reshape + roll + rot90 Added: numpy-docs/trunk/source/reference/routines.bitwise.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.bitwise.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.bitwise.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,31 @@ +Binary operations +***************** + +.. currentmodule:: numpy + +Elementwise bit operations +-------------------------- +.. autosummary:: + :toctree: generated/ + + bitwise_and + bitwise_or + bitwise_xor + invert + left_shift + right_shift + +Bit packing +----------- +.. autosummary:: + :toctree: generated/ + + packbits + unpackbits + +Output formatting +----------------- +.. autosummary:: + :toctree: generated/ + + binary_repr Added: numpy-docs/trunk/source/reference/routines.ctypeslib.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.ctypeslib.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.ctypeslib.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,11 @@ +*********************************************************** +C-Types Foreign Function Interface (:mod:`numpy.ctypeslib`) +*********************************************************** + +.. currentmodule:: numpy.ctypeslib + +.. autofunction:: as_array +.. autofunction:: as_ctypes +.. autofunction:: ctypes_load_library +.. autofunction:: load_library +.. autofunction:: ndpointer Added: numpy-docs/trunk/source/reference/routines.dtype.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.dtype.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.dtype.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,52 @@ +.. _routines.dtype: + +Data type routines +================== + +.. currentmodule:: numpy + +.. autosummary:: + :toctree: generated/ + + can_cast + common_type + obj2sctype + +Creating data types +------------------- + +.. autosummary:: + :toctree: generated/ + + + dtype + format_parser + +Data type information +--------------------- +.. autosummary:: + :toctree: generated/ + + finfo + iinfo + MachAr + +Data type testing +----------------- +.. autosummary:: + :toctree: generated/ + + issctype + issubdtype + issubsctype + issubclass_ + find_common_type + +Miscellaneous +------------- +.. autosummary:: + :toctree: generated/ + + typename + sctype2char + mintypecode Added: numpy-docs/trunk/source/reference/routines.dual.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.dual.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.dual.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,48 @@ +Optionally Scipy-accelerated routines (:mod:`numpy.dual`) +********************************************************* + +.. automodule:: numpy.dual + +Linear algebra +-------------- + +.. currentmodule:: numpy.linalg + +.. autosummary:: + + cholesky + det + eig + eigh + eigvals + eigvalsh + inv + lstsq + norm + pinv + solve + svd + +FFT +--- + +.. currentmodule:: numpy.fft + +.. autosummary:: + + fft + fft2 + fftn + ifft + ifft2 + ifftn + +Other +----- + +.. currentmodule:: numpy + +.. autosummary:: + + i0 + Added: numpy-docs/trunk/source/reference/routines.emath.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.emath.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.emath.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,10 @@ +Mathematical functions with automatic domain (:mod:`numpy.emath`) +*********************************************************************** + +.. currentmodule:: numpy + +.. note:: :mod:`numpy.emath` is a preferred alias for :mod:`numpy.lib.scimath`, + available after :mod:`numpy` is imported. + +.. automodule:: numpy.lib.scimath + :members: Added: numpy-docs/trunk/source/reference/routines.err.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.err.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.err.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,25 @@ +Floating point error handling +***************************** + +.. currentmodule:: numpy + +Setting and getting error handling +---------------------------------- + +.. autosummary:: + :toctree: generated/ + + seterr + geterr + seterrcall + geterrcall + errstate + +Internal functions +------------------ + +.. autosummary:: + :toctree: generated/ + + seterrobj + geterrobj Added: numpy-docs/trunk/source/reference/routines.fft.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.fft.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.fft.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,59 @@ +.. _routines.fft: + +Fourier transforms (:mod:`numpy.fft`) +************************************* + +.. currentmodule:: numpy.fft + +1-dimensional +------------- +.. autosummary:: + :toctree: generated/ + + fft + ifft + +2-dimensional +------------- +.. autosummary:: + :toctree: generated/ + + fft2 + ifft2 + +N-dimensional +------------- +.. autosummary:: + :toctree: generated/ + + fftn + ifftn + +Hermite symmetric +----------------- +.. autosummary:: + :toctree: generated/ + + hfft + ihfft + +Real-valued +----------- +.. autosummary:: + :toctree: generated/ + + rfft + irfft + rfft2 + irfft2 + rfftn + irfftn + +Helper routines +--------------- +.. autosummary:: + :toctree: generated/ + + fftfreq + fftshift + ifftshift Added: numpy-docs/trunk/source/reference/routines.financial.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.financial.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.financial.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,21 @@ +Financial functions +******************* + +.. currentmodule:: numpy + +Simple financial functions +-------------------------- + +.. autosummary:: + :toctree: generated/ + + fv + pv + npv + pmt + ppmt + ipmt + irr + mirr + nper + rate Added: numpy-docs/trunk/source/reference/routines.functional.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.functional.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.functional.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,13 @@ +Functional programming +********************** + +.. currentmodule:: numpy + +.. autosummary:: + :toctree: generated/ + + apply_along_axis + apply_over_axes + vectorize + frompyfunc + piecewise Added: numpy-docs/trunk/source/reference/routines.help.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.help.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.help.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,24 @@ +.. _routines.help: + +Numpy-specific help functions +============================= + +.. currentmodule:: numpy + +Finding help +------------ + +.. autosummary:: + :toctree: generated/ + + lookfor + + +Reading help +------------ + +.. autosummary:: + :toctree: generated/ + + info + source Added: numpy-docs/trunk/source/reference/routines.indexing.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.indexing.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.indexing.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,53 @@ +.. _routines.indexing: + +Indexing routines +================= + +.. seealso:: :ref:`Indexing ` + +.. currentmodule:: numpy + +Generating index arrays +----------------------- +.. autosummary:: + :toctree: generated/ + + c_ + r_ + s_ + nonzero + where + indices + ix_ + ogrid + unravel_index + +Indexing-like operations +------------------------ +.. autosummary:: + :toctree: generated/ + + take + choose + compress + diag + diagonal + select + +Inserting data into arrays +-------------------------- +.. autosummary:: + :toctree: generated/ + + place + put + putmask + +Iterating over arrays +--------------------- +.. autosummary:: + :toctree: generated/ + + ndenumerate + ndindex + flatiter Added: numpy-docs/trunk/source/reference/routines.io.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.io.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.io.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,64 @@ +Input and output +**************** + +.. currentmodule:: numpy + +NPZ files +--------- +.. autosummary:: + :toctree: generated/ + + load + save + savez + +Text files +---------- +.. autosummary:: + :toctree: generated/ + + loadtxt + savetxt + fromregex + fromstring + ndarray.tofile + ndarray.tolist + +String formatting +----------------- +.. autosummary:: + :toctree: generated/ + + array_repr + array_str + +Memory mapping files +-------------------- +.. autosummary:: + :toctree: generated/ + + memmap + +Text formatting options +----------------------- +.. autosummary:: + :toctree: generated/ + + set_printoptions + get_printoptions + set_string_function + +Base-n representations +---------------------- +.. autosummary:: + :toctree: generated/ + + binary_repr + base_repr + +Data sources +------------ +.. autosummary:: + :toctree: generated/ + + DataSource Added: numpy-docs/trunk/source/reference/routines.linalg.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.linalg.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.linalg.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,67 @@ +.. _routines.linalg: + +Linear algebra (:mod:`numpy.linalg`) +************************************ + +.. currentmodule:: numpy + +Matrix and vector products +-------------------------- +.. autosummary:: + :toctree: generated/ + + dot + vdot + inner + outer + tensordot + linalg.matrix_power + kron + +Decompositions +-------------- +.. autosummary:: + :toctree: generated/ + + linalg.cholesky + linalg.qr + linalg.svd + +Matrix eigenvalues +------------------ +.. autosummary:: + :toctree: generated/ + + linalg.eig + linalg.eigh + linalg.eigvals + linalg.eigvalsh + +Norms and other numbers +----------------------- +.. autosummary:: + :toctree: generated/ + + linalg.norm + linalg.cond + linalg.det + trace + +Solving equations and inverting matrices +---------------------------------------- +.. autosummary:: + :toctree: generated/ + + linalg.solve + linalg.tensorsolve + linalg.lstsq + linalg.inv + linalg.pinv + linalg.tensorinv + +Exceptions +---------- +.. autosummary:: + :toctree: generated/ + + linalg.LinAlgError Added: numpy-docs/trunk/source/reference/routines.logic.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.logic.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.logic.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,64 @@ +Logic functions +*************** + +.. currentmodule:: numpy + +Truth value testing +------------------- +.. autosummary:: + :toctree: generated/ + + all + any + +Array contents +-------------- +.. autosummary:: + :toctree: generated/ + + isfinite + isinf + isnan + isneginf + isposinf + +Array type testing +------------------ +.. autosummary:: + :toctree: generated/ + + iscomplex + iscomplexobj + isfortran + isreal + isrealobj + isscalar + +Logical operations +------------------ +.. autosummary:: + :toctree: generated/ + + logical_and + logical_or + logical_not + logical_xor + +Comparison +---------- +.. autosummary:: + :toctree: generated/ + + allclose + array_equal + array_equiv + +.. autosummary:: + :toctree: generated/ + + greater + greater_equal + less + less_equal + equal + not_equal Added: numpy-docs/trunk/source/reference/routines.ma.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.ma.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.ma.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,52 @@ +.. _routines.ma: + +Masked array operations +*********************** + +.. currentmodule:: numpy + +Creation +-------- + +.. autosummary:: + :toctree: generated/ + + ma.masked_array + +Converting to ndarray +--------------------- + +.. autosummary:: + :toctree: generated/ + + ma.filled + ma.common_fill_value + ma.default_fill_value + ma.masked_array.get_fill_value + ma.maximum_fill_value + ma.minimum_fill_value + +Inspecting the array +-------------------- + +.. autosummary:: + :toctree: generated/ + + ma.getmask + ma.getmaskarray + ma.getdata + ma.count_masked + +Modifying the mask +------------------ + +.. autosummary:: + :toctree: generated/ + + ma.make_mask + ma.mask_cols + ma.mask_or + ma.mask_rowcols + ma.mask_rows + ma.harden_mask + ma.ids Added: numpy-docs/trunk/source/reference/routines.math.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.math.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.math.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,143 @@ +Mathematical functions +********************** + +.. currentmodule:: numpy + +Trigonometric functions +----------------------- +.. autosummary:: + :toctree: generated/ + + sin + cos + tan + arcsin + arccos + arctan + hypot + arctan2 + degrees + radians + unwrap + +Hyperbolic functions +-------------------- +.. autosummary:: + :toctree: generated/ + + sinh + cosh + tanh + arcsinh + arccosh + arctanh + +Rounding +-------- +.. autosummary:: + :toctree: generated/ + + around + round_ + rint + fix + floor + ceil + +Sums, products, differences +--------------------------- +.. autosummary:: + :toctree: generated/ + + prod + sum + nansum + cumprod + cumsum + diff + ediff1d + gradient + cross + trapz + +Exponents and logarithms +------------------------ +.. autosummary:: + :toctree: generated/ + + exp + expm1 + log + log10 + log2 + log1p + +Other special functions +----------------------- +.. autosummary:: + :toctree: generated/ + + i0 + sinc + +Floating point routines +----------------------- +.. autosummary:: + :toctree: generated/ + + signbit + frexp + ldexp + +Arithmetic operations +--------------------- +.. autosummary:: + :toctree: generated/ + + add + reciprocal + negative + multiply + divide + power + subtract + true_divide + floor_divide + + fmod + mod + modf + remainder + +Handling complex numbers +------------------------ +.. autosummary:: + :toctree: generated/ + + angle + real + imag + conj + + +Miscellaneous +------------- +.. autosummary:: + :toctree: generated/ + + convolve + clip + + sqrt + square + + absolute + fabs + sign + maximum + minimum + + nan_to_num + real_if_close + + interp Added: numpy-docs/trunk/source/reference/routines.matlib.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.matlib.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.matlib.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,11 @@ +Matrix library (:mod:`numpy.matlib`) +************************************ + +.. currentmodule:: numpy + +This module contains all functions in the :mod:`numpy` namespace, with +the following replacement functions that return :class:`matrices +` instead of :class:`ndarrays `. + +.. automodule:: numpy.matlib + :members: Added: numpy-docs/trunk/source/reference/routines.numarray.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.numarray.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.numarray.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,6 @@ +********************************************** +Numarray compatibility (:mod:`numpy.numarray`) +********************************************** + +.. automodule:: numpy.numarray + :members: Added: numpy-docs/trunk/source/reference/routines.oldnumeric.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.oldnumeric.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.oldnumeric.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,8 @@ +*************************************************** +Old Numeric compatibility (:mod:`numpy.oldnumeric`) +*************************************************** + +.. currentmodule:: numpy + +.. automodule:: numpy.oldnumeric + :members: Added: numpy-docs/trunk/source/reference/routines.other.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.other.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.other.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,24 @@ +Miscellaneous routines +********************** + +.. toctree:: + +.. currentmodule:: numpy + +Buffer objects +-------------- +.. autosummary:: + :toctree: generated/ + + getbuffer + newbuffer + +Performance tuning +------------------ +.. autosummary:: + :toctree: generated/ + + alterdot + restoredot + setbufsize + getbufsize Added: numpy-docs/trunk/source/reference/routines.poly.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.poly.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.poly.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,46 @@ +Polynomials +*********** + +.. currentmodule:: numpy + +Basics +------ +.. autosummary:: + :toctree: generated/ + + poly1d + polyval + poly + roots + +Fitting +------- +.. autosummary:: + :toctree: generated/ + + polyfit + +Calculus +-------- +.. autosummary:: + :toctree: generated/ + + polyder + polyint + +Arithmetic +---------- +.. autosummary:: + :toctree: generated/ + + polyadd + polydiv + polymul + polysub + +Warnings +-------- +.. autosummary:: + :toctree: generated/ + + RankWarning Added: numpy-docs/trunk/source/reference/routines.random.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.random.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.random.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,77 @@ +.. _routines.random: + +Random sampling (:mod:`numpy.random`) +************************************* + +.. currentmodule:: numpy.random + +Simple random data +================== +.. autosummary:: + :toctree: generated/ + + rand + randn + randint + random_integers + random_sample + bytes + +Permutations +============ +.. autosummary:: + :toctree: generated/ + + shuffle + permutation + +Distributions +============= +.. autosummary:: + :toctree: generated/ + + beta + binomial + chisquare + mtrand.dirichlet + exponential + f + gamma + geometric + gumbel + hypergeometric + laplace + logistic + lognormal + logseries + multinomial + multivariate_normal + negative_binomial + noncentral_chisquare + noncentral_f + normal + pareto + poisson + power + rayleigh + standard_cauchy + standard_exponential + standard_gamma + standard_normal + standard_t + triangular + uniform + vonmises + wald + weibull + zipf + +Random generator +================ +.. autosummary:: + :toctree: generated/ + + mtrand.RandomState + seed + get_state + set_state Added: numpy-docs/trunk/source/reference/routines.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,35 @@ +******** +Routines +******** + +.. toctree:: + :maxdepth: 2 + + routines.array-creation + routines.array-manipulation + routines.indexing + routines.dtype + routines.io + routines.fft + routines.linalg + routines.random + routines.sort + routines.logic + routines.bitwise + routines.statistics + routines.math + routines.functional + routines.poly + routines.financial + routines.set + routines.window + routines.err + routines.ma + routines.help + routines.other + routines.emath + routines.matlib + routines.dual + routines.numarray + routines.oldnumeric + routines.ctypeslib Added: numpy-docs/trunk/source/reference/routines.set.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.set.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.set.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,23 @@ +Set routines +============ + +.. currentmodule:: numpy + +Making proper sets +------------------ +.. autosummary:: + :toctree: generated/ + + unique1d + +Boolean operations +------------------ +.. autosummary:: + :toctree: generated/ + + intersect1d + intersect1d_nu + setdiff1d + setmember1d + setxor1d + union1d Added: numpy-docs/trunk/source/reference/routines.sort.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.sort.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.sort.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,32 @@ +Sorting and searching +===================== + +.. currentmodule:: numpy + +Sorting +------- +.. autosummary:: + :toctree: generated/ + + sort + lexsort + argsort + ndarray.sort + msort + sort_complex + +Searching +--------- +.. autosummary:: + :toctree: generated/ + + argmax + nanargmax + argmin + nanargmin + argwhere + nonzero + flatnonzero + where + searchsorted + extract Added: numpy-docs/trunk/source/reference/routines.statistics.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.statistics.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.statistics.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,51 @@ +Statistics +========== + +.. currentmodule:: numpy + + +Extremal values +--------------- + +.. autosummary:: + :toctree: generated/ + + amin + amax + nanmax + nanmin + ptp + +Averages and variances +---------------------- + +.. autosummary:: + :toctree: generated/ + + average + mean + median + std + var + +Correlating +----------- + +.. autosummary:: + :toctree: generated/ + + corrcoef + correlate + cov + +Histograms +---------- + +.. autosummary:: + :toctree: generated/ + + histogram + histogram2d + histogramdd + bincount + digitize Added: numpy-docs/trunk/source/reference/routines.window.rst =================================================================== --- numpy-docs/trunk/source/reference/routines.window.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/routines.window.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,16 @@ +Window functions +================ + +.. currentmodule:: numpy + +Various windows +--------------- + +.. autosummary:: + :toctree: generated/ + + bartlett + blackman + hamming + hanning + kaiser Added: numpy-docs/trunk/source/reference/ufuncs.rst =================================================================== --- numpy-docs/trunk/source/reference/ufuncs.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/reference/ufuncs.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,551 @@ +.. sectionauthor:: adapted from "Guide to Numpy" by Travis E. Oliphant + +.. _ufuncs: + +************************************ +Universal functions (:class:`ufunc`) +************************************ + +.. note: XXX: section might need to be made more reference-guideish... + +.. currentmodule:: numpy + +.. index: ufunc, universal function, arithmetic, operation + +A universal function (or :term:`ufunc` for short) is a function that +operates on :class:`ndarrays ` in an element-by-element fashion, +supporting :ref:`array broadcasting `, :ref:`type +casting `, and several other standard features. That +is, a ufunc is a ":term:`vectorized`" wrapper for a function that +takes a fixed number of scalar inputs and produces a fixed number of +scalar outputs. + +In Numpy, universal functions are instances of the +:class:`numpy.ufunc` class. Many of the built-in functions are +implemented in compiled C code, but :class:`ufunc` instances can also +be produced using the :func:`frompyfunc` factory function. + + +.. _ufuncs.broadcasting: + +Broadcasting +============ + +.. index:: broadcasting + +Each universal function takes array inputs and produces array outputs +by performing the core function element-wise on the inputs. Standard +broadcasting rules are applied so that inputs not sharing exactly the +same shapes can still be usefully operated on. Broadcasting can be +understood by four rules: + +1. All input arrays with :attr:`ndim ` smaller than the + input array of largest :attr:`ndim ` have 1's + prepended to their shapes. + +2. The size in each dimension of the output shape is the maximum of all + the input shapes in that dimension. + +3. An input can be used in the calculation if it's shape in a particular + dimension either matches the output shape or has value exactly 1. + +4. If an input has a dimension size of 1 in its shape, the first data + entry in that dimension will be used for all calculations along + that dimension. In other words, the stepping machinery of the + :term:`ufunc` will simply not step along that dimension when + otherwise needed (the :term:`stride` will be 0 for that dimension). + +Broadcasting is used throughout NumPy to decide how to handle non +equally-shaped arrays; for example all arithmetic operators (``+``, +``-``, ``*``, ...) between :class:`ndarrays ` broadcast the +arrays before operation. + +.. _arrays.broadcasting.broadcastable: + +.. index:: broadcastable + +A set of arrays is called ":term:`broadcastable`" to the same shape if +the above rules produce a valid result, *i.e.*, one of the following +is true: + +1. The arrays all have exactly the same shape. + +2. The arrays all have the same number of dimensions and the length of + each dimensions is either a common length or 1. + +3. The arrays that have too few dimensions can have their shapes prepended + with a dimension of length 1 to satisfy property 2. + +.. admonition:: Example + + If ``a.shape`` is (5,1), ``b.shape`` is (1,6), ``c.shape`` is (6,) + and d.shape is ``()`` so that d is a scalar, then *a*, *b*, *c*, + and *d* are all broadcastable to dimension (5,6); and + + - *a* acts like a (5,6) array where ``a[:,0]`` is broadcast to the other + columns, + + - *b* acts like a (5,6) array where ``b[0,:]`` is broadcast + to the other rows, + + - *c* acts like a (1,6) array and therefore like a (5,6) array + where ``c[:]` is broadcast to every row, and finally, + + - *d* acts like a (5,6) array where the single value is repeated. + + +.. _ufuncs.output-type: + +Output type determination +========================= + +The output of the ufunc (and its methods) is not necessarily an +:class:`ndarray`, if all input arguments are not :class:`ndarrays `. + +All output arrays will be passed to the :obj:`__array_wrap__` +method of the input (besides :class:`ndarrays `, and scalars) +that defines it **and** has the highest :obj:`__array_priority__` of +any other input to the universal function. The default +:obj:`__array_priority__` of the ndarray is 0.0, and the default +:obj:`__array_priority__` of a subtype is 1.0. Matrices have +:obj:`__array_priority__` equal to 10.0. + +The ufuncs can also all take output arguments. The output will be cast +if necessary to the provided output array. If a class with an +:obj:`__array__` method is used for the output, results will be +written to the object returned by :obj:`__array__`. Then, if the class +also has an :obj:`__array_wrap__` method, the returned +:class:`ndarray` result will be passed to that method just before +passing control back to the caller. + +Use of internal buffers +======================= + +.. index:: buffers + +Internally, buffers are used for misaligned data, swapped data, and +data that has to be converted from one data type to another. The size +of the internal buffers is settable on a per-thread basis. There can +be up to :math:`2 (n_{\mathrm{inputs}} + n_{\mathrm{outputs}})` +buffers of the specified size created to handle the data from all the +inputs and outputs of a ufunc. The default size of the buffer is +10,000 elements. Whenever buffer-based calculation would be needed, +but all input arrays are smaller than the buffer size, those +misbehaved or incorrect typed arrays will be copied before the +calculation proceeds. Adjusting the size of the buffer may therefore +alter the speed at which ufunc calculations of various sorts are +completed. A simple interface for setting this variable is accessible +using the function + +.. autosummary:: + :toctree: generated/ + + setbufsize + + +Error handling +============== + +.. index:: error handling + +Universal functions can trip special floating point status registers +in your hardware (such as divide-by-zero). If available on your +platform, these registers will be regularly checked during +calculation. Error handling is controlled on a per-thread basis, +and can be configured using the functions + +.. autosummary:: + :toctree: generated/ + + seterr + seterrcall + +.. _ufuncs.casting: + +Casting Rules +============= + +.. index:: + pair: ufunc; casting rules + +At the core of every ufunc is a one-dimensional strided loop that +implements the actual function for a specific type combination. When a +ufunc is created, it is given a static list of inner loops and a +corresponding list of type signatures over which the ufunc operates. +The ufunc machinery uses this list to determine which inner loop to +use for a particular case. You can inspect the :attr:`.types +` attribute for a particular ufunc to see which type +combinations have a defined inner loop and which output type they +produce (:ref:`character codes ` are used in +that output for brevity). + +Casting must be done on one or more of the inputs whenever the ufunc +does not have a core loop implementation for the input types provided. +If an implementation for the input types cannot be found, then the +algorithm searches for an implementation with a type signature to +which all of the inputs can be cast "safely." The first one it finds +in its internal list of loops is selected and performed with types +cast. Recall that internal copies during ufuncs (even for casting) are +limited to the size of an internal buffer which is user settable. + +.. note:: + + Universal functions in NumPy are flexible enough to have mixed type + signatures. Thus, for example, a universal function could be defined + that works with floating point and integer values. See :func:`ldexp` + for an example. + +By the above description, the casting rules are essentially +implemented by the question of when a data type can be cast "safely" +to another data type. The answer to this question can be determined in +Python with a function call: :func:`can_cast(fromtype, totype) +`. Figure shows the results of this call for my 32-bit +system on the 21 internally supported types. You can generate this +table for your system with code shown in that Figure. + +.. admonition:: Figure + + Code segment showing the can cast safely table for a 32-bit system. + + >>> def print_table(ntypes): + ... print 'X', + ... for char in ntypes: print char, + ... print + ... for row in ntypes: + ... print row, + ... for col in ntypes: + ... print int(np.can_cast(row, col)), + ... print + >>> print_table(np.typecodes['All']) + X ? b h i l q p B H I L Q P f d g F D G S U V O + ? 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + b 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 + h 0 0 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 + i 0 0 0 1 1 1 1 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 + l 0 0 0 1 1 1 1 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 + q 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 + p 0 0 0 1 1 1 1 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 + B 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + H 0 0 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + I 0 0 0 0 0 1 0 0 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 + L 0 0 0 0 0 1 0 0 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 + Q 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 1 1 1 1 + P 0 0 0 0 0 1 0 0 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 + f 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 + d 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 + g 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 + F 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 + D 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 + G 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 + S 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 + U 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 + V 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 + O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 + +You should note that, while included in the table for completeness, +the 'S', 'U', and 'V' types cannot be operated on by ufuncs. Also, +note that on a 64-bit system the integer types may have different +sizes resulting in a slightly altered table. + +Mixed scalar-array operations use a different set of casting rules +that ensure that a scalar cannot upcast an array unless the scalar is +of a fundamentally different kind of data (*i.e.* under a different +hierachy in the data type hierarchy) than the array. This rule +enables you to use scalar constants in your code (which as Python +types are interpreted accordingly in ufuncs) without worrying about +whether the precision of the scalar constant will cause upcasting on +your large (small precision) array. + + +:class:`ufunc` +============== + +Optional keyword arguments +-------------------------- + +All ufuncs take optional keyword arguments. These represent rather +advanced usage and will likely not be used by most users. + +.. index:: + pair: ufunc; keyword arguments + +*sig* + + Either a data-type, a tuple of data-types, or a special signature + string indicating the input and output types of a ufunc. This argument + allows you to specify a specific signature for a the 1-d loop to use + in the underlying calculation. If the loop specified does not exist + for the ufunc, then a TypeError is raised. Normally a suitable loop is + found automatically by comparing the input types with what is + available and searching for a loop with data-types to which all inputs + can be cast safely. This key-word argument lets you by-pass that + search and choose a loop you want. A list of available signatures is + available in the **types** attribute of the ufunc object. + +*extobj* + + a list of length 1, 2, or 3 specifying the ufunc buffer-size, the + error mode integer, and the error call-back function. Normally, these + values are looked-up in a thread-specific dictionary. Passing them + here bypasses that look-up and uses the low-level specification + provided for the error-mode. This may be useful as an optimization for + calculations requiring lots of ufuncs on small arrays in a loop. + + +Attributes +---------- + +There are some informational attributes that universal functions +possess. None of the attributes can be set. + +.. index:: + pair: ufunc; attributes + + +============ ================================================================= +**__doc__** A docstring for each ufunc. The first part of the docstring is + dynamically generated from the number of outputs, the name, and + the number of inputs. The second part of the doc string is + provided at creation time and stored with the ufunc. + +**__name__** The name of the ufunc. +============ ================================================================= + +.. autosummary:: + :toctree: generated/ + + ufunc.nin + ufunc.nout + ufunc.nargs + ufunc.ntypes + ufunc.types + ufunc.identity + +Methods +------- + +All ufuncs have 4 methods. However, these methods only make sense on +ufuncs that take two input arguments and return one output argument. +Attempting to call these methods on other ufuncs will cause a +:exc:`ValueError` . The reduce-like methods all take an *axis* keyword +and a *dtype* keyword, and the arrays must all have dimension >= +1. The *axis* keyword specifies which axis of the array the reduction +will take place over and may be negative, but must be an integer. The +*dtype* keyword allows you to manage a very common problem that arises +when naively using `{op}.reduce `. Sometimes you may +have an array of a certain data type and wish to add up all of its +elements, but the result does not fit into the data type of the +array. This commonly happens if you have an array of single-byte +integers. The *dtype* keyword allows you to alter the data type that the +reduction takes place over (and therefore the type of the +output). Thus, you can ensure that the output is a data type with +large-enough precision to handle your output. The responsibility of +altering the reduce type is mostly up to you. There is one exception: +if no *dtype* is given for a reduction on the "add" or "multiply" +operations, then if the input type is an integer (or boolean) data- +type and smaller than the size of the :class:`int_` data type, it will +be internally upcast to the :class:`int_` (or :class:`uint`) data +type. + +.. index:: + pair: ufunc; methods + +.. autosummary:: + :toctree: generated/ + + ufunc.reduce + ufunc.accumulate + ufunc.reduceat + ufunc.outer + + +.. warning:: + + A reduce-like operation on an array with a data type that has + range "too small "to handle the result will silently wrap. You + should use dtype to increase the data type over which reduction + takes place. + + +Available ufuncs +================ + +There are currently more than 60 universal functions defined in +:mod:`numpy` on one or more types, covering a wide variety of +operations. Some of these ufuncs are called automatically on arrays +when the relevant infix notation is used (*e.g.* :func:`add(a, b) ` +is called internally when ``a + b`` is written and *a* or *b* is an +:class:`ndarray`). Nonetheless, you may still want to use the ufunc +call in order to use the optional output argument(s) to place the +output(s) in an object (or in objects) of your choice. + +Recall that each ufunc operates element-by-element. Therefore, each +ufunc will be described as if acting on a set of scalar inputs to +return a set of scalar outputs. + +.. note:: + + The ufunc still returns its output(s) even if you use the optional + output argument(s). + +Math operations +--------------- + +.. autosummary:: + + add + subtract + multiply + divide + true_divide + floor_divide + negative + power + remainder + mod + fmod + absolute + rint + sign + conj + exp + log + expm1 + log1p + log10 + sqrt + square + reciprocal + ones_like + +.. tip:: + + The optional output arguments can be used to help you save memory + for large calculations. If your arrays are large, complicated + expressions can take longer than absolutely necessary due to the + creation and (later) destruction of temporary calculation + spaces. For example, the expression ``G=a*b+c`` is equivalent to + ``t1=A*B; G=T1+C; del t1``. It will be more quickly executed as + ``G=A*B; add(G,C,G)`` which is the same as ``G=A*B; G+=C``. + + +Trigonometric functions +----------------------- +All trigonometric functions use radians when an angle is called for. +The ratio of degrees to radians is :math:`180^{\circ}/\pi.` + +.. autosummary:: + + sin + cos + tan + arcsin + arccos + arctan + arctan2 + hypot + sinh + cosh + tanh + arcsinh + arccosh + arctanh + +Bit-twiddling functions +----------------------- + +These function all need integer arguments and they maniuplate the bit- +pattern of those arguments. + +.. autosummary:: + + bitwise_and + bitwise_or + bitwise_xor + invert + left_shift + right_shift + +Comparison functions +-------------------- + +.. autosummary:: + + greater + greater_equal + less + less_equal + not_equal + equal + +.. warning:: + + Do not use the Python keywords ``and`` and ``or`` to combine + logical array expressions. These keywords will test the truth + value of the entire array (not element-by-element as you might + expect). Use the bitwise operators: & and \| instead. + +.. autosummary:: + + logical_and + logical_or + logical_xor + logical_not + +.. warning:: + + The Bitwise operators (& and \|) are the proper way to combine + element-by-element array comparisons. Be sure to understand the + operator precedence: (a>2) & (a<5) is the proper syntax because a>2 & + a<5 will result in an error due to the fact that 2 & a is evaluated + first. + +.. autosummary:: + + maximum + +.. tip:: + + The Python function max() will find the maximum over a one-dimensional + array, but it will do so using a slower sequence interface. The reduce + method of the maximum ufunc is much faster. Also, the max() method + will not give answers you might expect for arrays with greater than + one dimension. The reduce method of minimum also allows you to compute + a total minimum over an array. + +.. autosummary:: + + minimum + +.. warning:: + + the behavior of maximum(a,b) is than that of max(a,b). As a ufunc, + maximum(a,b) performs an element-by-element comparison of a and b and + chooses each element of the result according to which element in the + two arrays is larger. In contrast, max(a,b) treats the objects a and b + as a whole, looks at the (total) truth value of a>b and uses it to + return either a or b (as a whole). A similar difference exists between + minimum(a,b) and min(a,b). + + +Floating functions +------------------ + +Recall that all of these functions work element-by-element over an +array, returning an array output. The description details only a +single operation. + +.. autosummary:: + + isreal + iscomplex + isfinite + isinf + isnan + signbit + modf + ldexp + frexp + fmod + floor + ceil Added: numpy-docs/trunk/source/scipyshiny_small.png =================================================================== (Binary files differ) Property changes on: numpy-docs/trunk/source/scipyshiny_small.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: numpy-docs/trunk/source/user/basics.broadcasting.rst =================================================================== --- numpy-docs/trunk/source/user/basics.broadcasting.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/basics.broadcasting.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,7 @@ +************ +Broadcasting +************ + +.. seealso:: :class:`numpy.broadcast` + +.. automodule:: numpy.doc.broadcasting Added: numpy-docs/trunk/source/user/basics.creation.rst =================================================================== --- numpy-docs/trunk/source/user/basics.creation.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/basics.creation.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,9 @@ +.. _arrays.creation: + +************** +Array creation +************** + +.. seealso:: :ref:`Array creation routines ` + +.. automodule:: numpy.doc.creation Added: numpy-docs/trunk/source/user/basics.indexing.rst =================================================================== --- numpy-docs/trunk/source/user/basics.indexing.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/basics.indexing.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,16 @@ +.. _basics.indexing: + +******** +Indexing +******** + +.. seealso:: :ref:`Indexing routines ` + +.. note:: + + XXX: Combine ``numpy.doc.indexing`` with material + section 2.2 Basic indexing? + Or incorporate the material directly here? + + +.. automodule:: numpy.doc.indexing Added: numpy-docs/trunk/source/user/basics.rec.rst =================================================================== --- numpy-docs/trunk/source/user/basics.rec.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/basics.rec.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,5 @@ +*************************************** +Structured arrays (aka "Record arrays") +*************************************** + +.. automodule:: numpy.doc.structured_arrays Added: numpy-docs/trunk/source/user/basics.rst =================================================================== --- numpy-docs/trunk/source/user/basics.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/basics.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,17 @@ +************ +Numpy basics +************ + +.. note:: + + XXX: there is overlap between this text extracted from ``numpy.doc`` + and "Guide to Numpy" chapter 2. Needs combining? + +.. toctree:: + + basics.types + basics.creation + basics.indexing + basics.broadcasting + basics.rec + basics.subclassing Added: numpy-docs/trunk/source/user/basics.subclassing.rst =================================================================== --- numpy-docs/trunk/source/user/basics.subclassing.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/basics.subclassing.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,7 @@ +.. _basics.subclassing: + +******************* +Subclassing ndarray +******************* + +.. automodule:: numpy.doc.subclassing Added: numpy-docs/trunk/source/user/basics.types.rst =================================================================== --- numpy-docs/trunk/source/user/basics.types.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/basics.types.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,14 @@ +********** +Data types +********** + +.. seealso:: :ref:`Data type objects ` + +.. note:: + + XXX: Combine ``numpy.doc.indexing`` with material from + "Guide to Numpy" (section 2.1 Data-Type descriptors)? + Or incorporate the material directly here? + + +.. automodule:: numpy.doc.basics Added: numpy-docs/trunk/source/user/c-info.beyond-basics.rst =================================================================== --- numpy-docs/trunk/source/user/c-info.beyond-basics.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/c-info.beyond-basics.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,734 @@ +***************** +Beyond the Basics +***************** + +| The voyage of discovery is not in seeking new landscapes but in having +| new eyes. +| --- *Marcel Proust* + +| Discovery is seeing what everyone else has seen and thinking what no +| one else has thought. +| --- *Albert Szent-Gyorgi* + + +Iterating over elements in the array +==================================== + +.. _`sec:array_iterator`: + +Basic Iteration +--------------- + +One common algorithmic requirement is to be able to walk over all +elements in a multidimensional array. The array iterator object makes +this easy to do in a generic way that works for arrays of any +dimension. Naturally, if you know the number of dimensions you will be +using, then you can always write nested for loops to accomplish the +iteration. If, however, you want to write code that works with any +number of dimensions, then you can make use of the array iterator. An +array iterator object is returned when accessing the .flat attribute +of an array. + +.. index:: + single: array iterator + +Basic usage is to call :cfunc:`PyArray_IterNew` ( ``array`` ) where array +is an ndarray object (or one of its sub-classes). The returned object +is an array-iterator object (the same object returned by the .flat +attribute of the ndarray). This object is usually cast to +PyArrayIterObject* so that its members can be accessed. The only +members that are needed are ``iter->size`` which contains the total +size of the array, ``iter->index``, which contains the current 1-d +index into the array, and ``iter->dataptr`` which is a pointer to the +data for the current element of the array. Sometimes it is also +useful to access ``iter->ao`` which is a pointer to the underlying +ndarray object. + +After processing data at the current element of the array, the next +element of the array can be obtained using the macro +:cfunc:`PyArray_ITER_NEXT` ( ``iter`` ). The iteration always proceeds in a +C-style contiguous fashion (last index varying the fastest). The +:cfunc:`PyArray_ITER_GOTO` ( ``iter``, ``destination`` ) can be used to +jump to a particular point in the array, where ``destination`` is an +array of npy_intp data-type with space to handle at least the number +of dimensions in the underlying array. Occasionally it is useful to +use :cfunc:`PyArray_ITER_GOTO1D` ( ``iter``, ``index`` ) which will jump +to the 1-d index given by the value of ``index``. The most common +usage, however, is given in the following example. + +.. code-block:: c + + PyObject *obj; /* assumed to be some ndarray object */ + PyArrayIterObject *iter; + ... + iter = (PyArrayIterObject *)PyArray_IterNew(obj); + if (iter == NULL) goto fail; /* Assume fail has clean-up code */ + while (iter->index < iter->size) { + /* do something with the data at it->dataptr */ + PyArray_ITER_NEXT(it); + } + ... + +You can also use :cfunc:`PyArrayIter_Check` ( ``obj`` ) to ensure you have +an iterator object and :cfunc:`PyArray_ITER_RESET` ( ``iter`` ) to reset an +iterator object back to the beginning of the array. + +It should be emphasized at this point that you may not need the array +iterator if your array is already contiguous (using an array iterator +will work but will be slower than the fastest code you could write). +The major purpose of array iterators is to encapsulate iteration over +N-dimensional arrays with arbitrary strides. They are used in many, +many places in the NumPy source code itself. If you already know your +array is contiguous (Fortran or C), then simply adding the element- +size to a running pointer variable will step you through the array +very efficiently. In other words, code like this will probably be +faster for you in the contiguous case (assuming doubles). + +.. code-block:: c + + npy_intp size; + double *dptr; /* could make this any variable type */ + size = PyArray_SIZE(obj); + dptr = PyArray_DATA(obj); + while(size--) { + /* do something with the data at dptr */ + dptr++; + } + + +Iterating over all but one axis +------------------------------- + +A common algorithm is to loop over all elements of an array and +perform some function with each element by issuing a function call. As +function calls can be time consuming, one way to speed up this kind of +algorithm is to write the function so it takes a vector of data and +then write the iteration so the function call is performed for an +entire dimension of data at a time. This increases the amount of work +done per function call, thereby reducing the function-call over-head +to a small(er) fraction of the total time. Even if the interior of the +loop is performed without a function call it can be advantageous to +perform the inner loop over the dimension with the highest number of +elements to take advantage of speed enhancements available on micro- +processors that use pipelining to enhance fundmental operations. + +The :cfunc:`PyArray_IterAllButAxis` ( ``array``, ``&dim`` ) constructs an +iterator object that is modified so that it will not iterate over the +dimension indicated by dim. The only restriction on this iterator +object, is that the :cfunc:`PyArray_Iter_GOTO1D` ( ``it``, ``ind`` ) macro +cannot be used (thus flat indexing won't work either if you pass this +object back to Python --- so you shouldn't do this). Note that the +returned object from this routine is still usually cast to +PyArrayIterObject \*. All that's been done is to modify the strides +and dimensions of the returned iterator to simulate iterating over +array[...,0,...] where 0 is placed on the +:math:`\textrm{dim}^{\textrm{th}}` dimension. If dim is negative, then +the dimension with the largest axis is found and used. + + +Iterating over multiple arrays +------------------------------ + +Very often, it is desireable to iterate over several arrays at the +same time. The universal functions are an example of this kind of +behavior. If all you want to do is iterate over arrays with the same +shape, then simply creating several iterator objects is the standard +procedure. For example, the following code iterates over two arrays +assumed to be the same shape and size (actually obj1 just has to have +at least as many total elements as does obj2): + +.. code-block:: c + + /* It is already assumed that obj1 and obj2 + are ndarrays of the same shape and size. + */ + iter1 = (PyArrayIterObject *)PyArray_IterNew(obj1); + if (iter1 == NULL) goto fail; + iter2 = (PyArrayIterObject *)PyArray_IterNew(obj2); + if (iter2 == NULL) goto fail; /* assume iter1 is DECREF'd at fail */ + while (iter2->index < iter2->size) { + /* process with iter1->dataptr and iter2->dataptr */ + PyArray_ITER_NEXT(iter1); + PyArray_ITER_NEXT(iter2); + } + + +Broadcasting over multiple arrays +--------------------------------- + +.. index:: + single: broadcasting + +When multiple arrays are involved in an operation, you may want to use the same +broadcasting rules that the math operations ( *i.e.* the ufuncs) use. This can +be done easily using the :ctype:`PyArrayMultiIterObject`. This is the object +returned from the Python command numpy.broadcast and it is almost as easy to +use from C. The function :cfunc:`PyArray_MultiIterNew` ( ``n``, ``...`` ) is +used (with ``n`` input objects in place of ``...`` ). The input objects can be +arrays or anything that can be converted into an array. A pointer to a +PyArrayMultiIterObject is returned. Broadcasting has already been accomplished +which adjusts the iterators so that all that needs to be done to advance to the +next element in each array is for PyArray_ITER_NEXT to be called for each of +the inputs. This incrementing is automatically performed by +:cfunc:`PyArray_MultiIter_NEXT` ( ``obj`` ) macro (which can handle a +multiterator ``obj`` as either a :ctype:`PyArrayMultiObject *` or a +:ctype:`PyObject *`). The data from input number ``i`` is available using +:cfunc:`PyArray_MultiIter_DATA` ( ``obj``, ``i`` ) and the total (broadcasted) +size as :cfunc:`PyArray_MultiIter_SIZE` ( ``obj``). An example of using this +feature follows. + +.. code-block:: c + + mobj = PyArray_MultiIterNew(2, obj1, obj2); + size = PyArray_MultiIter_SIZE(obj); + while(size--) { + ptr1 = PyArray_MultiIter_DATA(mobj, 0); + ptr2 = PyArray_MultiIter_DATA(mobj, 1); + /* code using contents of ptr1 and ptr2 */ + PyArray_MultiIter_NEXT(mobj); + } + +The function :cfunc:`PyArray_RemoveLargest` ( ``multi`` ) can be used to +take a multi-iterator object and adjust all the iterators so that +iteration does not take place over the largest dimension (it makes +that dimension of size 1). The code being looped over that makes use +of the pointers will very-likely also need the strides data for each +of the iterators. This information is stored in +multi->iters[i]->strides. + +.. index:: + single: array iterator + +There are several examples of using the multi-iterator in the NumPy +source code as it makes N-dimensional broadcasting-code very simple to +write. Browse the source for more examples. + +.. _`sec:Creating-a-new`: + +Creating a new universal function +================================= + +.. index:: + pair: ufunc; adding new + +The umath module is a computer-generated C-module that creates many +ufuncs. It provides a great many examples of how to create a universal +function. Creating your own ufunc that will make use of the ufunc +machinery is not difficult either. Suppose you have a function that +you want to operate element-by-element over its inputs. By creating a +new ufunc you will obtain a function that handles + +- broadcasting + +- N-dimensional looping + +- automatic type-conversions with minimal memory usage + +- optional output arrays + +It is not difficult to create your own ufunc. All that is required is +a 1-d loop for each data-type you want to support. Each 1-d loop must +have a specific signature, and only ufuncs for fixed-size data-types +can be used. The function call used to create a new ufunc to work on +built-in data-types is given below. A different mechanism is used to +register ufuncs for user-defined data-types. + +.. cfunction:: PyObject *PyUFunc_FromFuncAndData( PyUFuncGenericFunction* func, void** data, char* types, int ntypes, int nin, int nout, int identity, char* name, char* doc, int check_return) + + *func* + + A pointer to an array of 1-d functions to use. This array must be at + least ntypes long. Each entry in the array must be a ``PyUFuncGenericFunction`` function. This function has the following signature. An example of a + valid 1d loop function is also given. + + .. cfunction:: void loop1d(char** args, npy_intp* dimensions, npy_intp* steps, void* data) + + *args* + + An array of pointers to the actual data for the input and output + arrays. The input arguments are given first followed by the output + arguments. + + *dimensions* + + A pointer to the size of the dimension over which this function is + looping. + + *steps* + + A pointer to the number of bytes to jump to get to the + next element in this dimension for each of the input and + output arguments. + + *data* + + Arbitrary data (extra arguments, function names, *etc.* ) + that can be stored with the ufunc and will be passed in + when it is called. + + .. code-block:: c + + static void + double_add(char *args, npy_intp *dimensions, npy_intp *steps, void *extra) + { + npy_intp i; + npy_intp is1=steps[0], is2=steps[1]; + npy_intp os=steps[2], n=dimensions[0]; + char *i1=args[0], *i2=args[1], *op=args[2]; + for (i=0; i`__ . + + *arg_types* + + (optional) If given, this should contain an array of integers of at + least size ufunc.nargs containing the data-types expected by the loop + function. The data will be copied into a NumPy-managed structure so + the memory for this argument should be deleted after calling this + function. If this is NULL, then it will be assumed that all data-types + are of type usertype. + + *data* + + (optional) Specify any optional data needed by the function which will + be passed when the function is called. + + .. index:: + pair: dtype; adding new + + +Subtyping the ndarray in C +========================== + +One of the lesser-used features that has been lurking in Python since +2.2 is the ability to sub-class types in C. This facility is one of +the important reasons for basing NumPy off of the Numeric code-base +which was already in C. A sub-type in C allows much more flexibility +with regards to memory management. Sub-typing in C is not difficult +even if you have only a rudimentary understanding of how to create new +types for Python. While it is easiest to sub-type from a single parent +type, sub-typing from multiple parent types is also possible. Multiple +inheritence in C is generally less useful than it is in Python because +a restriction on Python sub-types is that they have a binary +compatible memory layout. Perhaps for this reason, it is somewhat +easier to sub-type from a single parent type. + +.. index:: + pair: ndarray; subtyping + +All C-structures corresponding to Python objects must begin with +:cmacro:`PyObject_HEAD` (or :cmacro:`PyObject_VAR_HEAD`). In the same +way, any sub-type must have a C-structure that begins with exactly the +same memory layout as the parent type (or all of the parent types in +the case of multiple-inheritance). The reason for this is that Python +may attempt to access a member of the sub-type structure as if it had +the parent structure ( *i.e.* it will cast a given pointer to a +pointer to the parent structure and then dereference one of it's +members). If the memory layouts are not compatible, then this attempt +will cause unpredictable behavior (eventually leading to a memory +violation and program crash). + +One of the elements in :cmacro:`PyObject_HEAD` is a pointer to a +type-object structure. A new Python type is created by creating a new +type-object structure and populating it with functions and pointers to +describe the desired behavior of the type. Typically, a new +C-structure is also created to contain the instance-specific +information needed for each object of the type as well. For example, +:cdata:`&PyArray_Type` is a pointer to the type-object table for the ndarray +while a :ctype:`PyArrayObject *` variable is a pointer to a particular instance +of an ndarray (one of the members of the ndarray structure is, in +turn, a pointer to the type- object table :cdata:`&PyArray_Type`). Finally +:cfunc:`PyType_Ready` () must be called for +every new Python type. + + +Creating sub-types +------------------ + +To create a sub-type, a similar proceedure must be followed except +only behaviors that are different require new entries in the type- +object structure. All other entires can be NULL and will be filled in +by :cfunc:`PyType_Ready` with appropriate functions from the parent +type(s). In particular, to create a sub-type in C follow these steps: + +1. If needed create a new C-structure to handle each instance of your + type. A typical C-structure would be: + + .. code-block:: c + + typedef _new_struct { + PyArrayObject base; + /* new things here */ + } NewArrayObject; + + Notice that the full PyArrayObject is used as the first entry in order + to ensure that the binary layout of instances of the new type is + identical to the PyArrayObject. + +2. Fill in a new Python type-object structure with pointers to new + functions that will over-ride the default behavior while leaving any + function that should remain the same unfilled (or NULL). The tp_name + element should be different. + +3. Fill in the tp_base member of the new type-object structure with a + pointer to the (main) parent type object. For multiple-inheritance, + also fill in the tp_bases member with a tuple containing all of the + parent objects in the order they should be used to define inheritance. + Remember, all parent-types must have the same C-structure for multiple + inheritance to work properly. + +4. Call :cfunc:`PyType_Ready` (). If this function + returns a negative number, a failure occurred and the type is not + initialized. Otherwise, the type is ready to be used. It is + generally important to place a reference to the new type into the + module dictionary so it can be accessed from Python. + +More information on creating sub-types in C can be learned by reading +PEP 253 (available at http://www.python.org/dev/peps/pep-0253). + + +Specific features of ndarray sub-typing +--------------------------------------- + +Some special methods and attributes are used by arrays in order to +facilitate the interoperation of sub-types with the base ndarray type. + +.. note:: XXX: some of the documentation below needs to be moved to the + reference guide. + + +The __array_finalize\__ method +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. attribute:: ndarray.__array_finalize__ + + Several array-creation functions of the ndarray allow + specification of a particular sub-type to be created. This allows + sub-types to be handled seamlessly in many routines. When a + sub-type is created in such a fashion, however, neither the + __new_\_ method nor the __init\__ method gets called. Instead, the + sub-type is allocated and the appropriate instance-structure + members are filled in. Finally, the :obj:`__array_finalize__` + attribute is looked-up in the object dictionary. If it is present + and not None, then it can be either a CObject containing a pointer + to a :cfunc:`PyArray_FinalizeFunc` or it can be a method taking a + single argument (which could be None). + + If the :obj:`__array_finalize__` attribute is a CObject, then the pointer + must be a pointer to a function with the signature: + + .. code-block:: c + + (int) (PyArrayObject *, PyObject *) + + The first argument is the newly created sub-type. The second argument + (if not NULL) is the "parent" array (if the array was created using + slicing or some other operation where a clearly-distinguishable parent + is present). This routine can do anything it wants to. It should + return a -1 on error and 0 otherwise. + + If the :obj:`__array_finalize__` attribute is not None nor a CObject, + then it must be a Python method that takes the parent array as an + argument (which could be None if there is no parent), and returns + nothing. Errors in this method will be caught and handled. + + +The __array_priority\__ attribute +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. attribute:: ndarray.__array_priority__ + + This attribute allows simple but flexible determination of which sub- + type should be considered "primary" when an operation involving two or + more sub-types arises. In operations where different sub-types are + being used, the sub-type with the largest :obj:`__array_priority__` + attribute will determine the sub-type of the output(s). If two sub- + types have the same :obj:`__array_priority__` then the sub-type of the + first argument determines the output. The default + :obj:`__array_priority__` attribute returns a value of 0.0 for the base + ndarray type and 1.0 for a sub-type. This attribute can also be + defined by objects that are not sub-types of the ndarray and can be + used to determine which :obj:`__array_wrap__` method should be called for + the return output. + +The __array_wrap\__ method +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. attribute:: ndarray.__array_wrap__ + + Any class or type can define this method which should take an ndarray + argument and return an instance of the type. It can be seen as the + opposite of the :obj:`__array__` method. This method is used by the + ufuncs (and other NumPy functions) to allow other objects to pass + through. For Python >2.4, it can also be used to write a decorator + that converts a function that works only with ndarrays to one that + works with any type with :obj:`__array__` and :obj:`__array_wrap__` methods. + +.. index:: + pair: ndarray; subtyping Added: numpy-docs/trunk/source/user/c-info.how-to-extend.rst =================================================================== --- numpy-docs/trunk/source/user/c-info.how-to-extend.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/c-info.how-to-extend.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,641 @@ +******************* +How to extend NumPy +******************* + +| That which is static and repetitive is boring. That which is dynamic +| and random is confusing. In between lies art. +| --- *John A. Locke* + +| Science is a differential equation. Religion is a boundary condition. +| --- *Alan Turing* + + +.. _`sec:Writing-an-extension`: + +Writing an extension module +=========================== + +While the ndarray object is designed to allow rapid computation in +Python, it is also designed to be general-purpose and satisfy a wide- +variety of computational needs. As a result, if absolute speed is +essential, there is no replacement for a well-crafted, compiled loop +specific to your application and hardware. This is one of the reasons +that numpy includes f2py so that an easy-to-use mechanisms for linking +(simple) C/C++ and (arbitrary) Fortran code directly into Python are +available. You are encouraged to use and improve this mechanism. The +purpose of this section is not to document this tool but to document +the more basic steps to writing an extension module that this tool +depends on. + +.. index:: + single: extension module + +When an extension module is written, compiled, and installed to +somewhere in the Python path (sys.path), the code can then be imported +into Python as if it were a standard python file. It will contain +objects and methods that have been defined and compiled in C code. The +basic steps for doing this in Python are well-documented and you can +find more information in the documentation for Python itself available +online at `www.python.org `_ . + +In addition to the Python C-API, there is a full and rich C-API for +NumPy allowing sophisticated manipulations on a C-level. However, for +most applications, only a few API calls will typically be used. If all +you need to do is extract a pointer to memory along with some shape +information to pass to another calculation routine, then you will use +very different calls, then if you are trying to create a new array- +like type or add a new data type for ndarrays. This chapter documents +the API calls and macros that are most commonly used. + + +Required subroutine +=================== + +There is exactly one function that must be defined in your C-code in +order for Python to use it as an extension module. The function must +be called init{name} where {name} is the name of the module from +Python. This function must be declared so that it is visible to code +outside of the routine. Besides adding the methods and constants you +desire, this subroutine must also contain calls to import_array() +and/or import_ufunc() depending on which C-API is needed. Forgetting +to place these commands will show itself as an ugly segmentation fault +(crash) as soon as any C-API subroutine is actually called. It is +actually possible to have multiple init{name} functions in a single +file in which case multiple modules will be defined by that file. +However, there are some tricks to get that to work correctly and it is +not covered here. + +A minimal ``init{name}`` method looks like: + +.. code-block:: c + + PyMODINIT_FUNC + init{name}(void) + { + (void)Py_InitModule({name}, mymethods); + import_array(); + } + +The mymethods must be an array (usually statically declared) of +PyMethodDef structures which contain method names, actual C-functions, +a variable indicating whether the method uses keyword arguments or +not, and docstrings. These are explained in the next section. If you +want to add constants to the module, then you store the returned value +from Py_InitModule which is a module object. The most general way to +add itmes to the module is to get the module dictionary using +PyModule_GetDict(module). With the module dictionary, you can add +whatever you like to the module manually. An easier way to add objects +to the module is to use one of three additional Python C-API calls +that do not require a separate extraction of the module dictionary. +These are documented in the Python documentation, but repeated here +for convenience: + +.. cfunction:: int PyModule_AddObject(PyObject* module, char* name, PyObject* value) + +.. cfunction:: int PyModule_AddIntConstant(PyObject* module, char* name, long value) + +.. cfunction:: int PyModule_AddStringConstant(PyObject* module, char* name, char* value) + + All three of these functions require the *module* object (the + return value of Py_InitModule). The *name* is a string that + labels the value in the module. Depending on which function is + called, the *value* argument is either a general object + (:cfunc:`PyModule_AddObject` steals a reference to it), an integer + constant, or a string constant. + + +Defining functions +================== + +The second argument passed in to the Py_InitModule function is a +structure that makes it easy to to define functions in the module. In +the example given above, the mymethods structure would have been +defined earlier in the file (usually right before the init{name} +subroutine) to: + +.. code-block:: c + + static PyMethodDef mymethods[] = { + { nokeywordfunc,nokeyword_cfunc, + METH_VARARGS, + Doc string}, + { keywordfunc, keyword_cfunc, + METH_VARARGS|METH_KEYWORDS, + Doc string}, + {NULL, NULL, 0, NULL} /* Sentinel */ + } + +Each entry in the mymethods array is a :ctype:`PyMethodDef` structure +containing 1) the Python name, 2) the C-function that implements the +function, 3) flags indicating whether or not keywords are accepted for +this function, and 4) The docstring for the function. Any number of +functions may be defined for a single module by adding more entries to +this table. The last entry must be all NULL as shown to act as a +sentinel. Python looks for this entry to know that all of the +functions for the module have been defined. + +The last thing that must be done to finish the extension module is to +actually write the code that performs the desired functions. There are +two kinds of functions: those that don't accept keyword arguments, and +those that do. + + +Functions without keyword arguments +----------------------------------- + +Functions that don't accept keyword arguments should be written as: + +.. code-block:: c + + static PyObject* + nokeyword_cfunc (PyObject *dummy, PyObject *args) + { + /* convert Python arguments */ + /* do function */ + /* return something */ + } + +The dummy argument is not used in this context and can be safely +ignored. The *args* argument contains all of the arguments passed in +to the function as a tuple. You can do anything you want at this +point, but usually the easiest way to manage the input arguments is to +call :cfunc:`PyArg_ParseTuple` (args, format_string, +addresses_to_C_variables...) or :cfunc:`PyArg_UnpackTuple` (tuple, "name" , +min, max, ...). A good description of how to use the first function is +contained in the Python C-API reference manual under section 5.5 +(Parsing arguments and building values). You should pay particular +attention to the "O&" format which uses converter functions to go +between the Python object and the C object. All of the other format +functions can be (mostly) thought of as special cases of this general +rule. There are several converter functions defined in the NumPy C-API +that may be of use. In particular, the :cfunc:`PyArray_DescrConverter` +function is very useful to support arbitrary data-type specification. +This function transforms any valid data-type Python object into a +:ctype:`PyArray_Descr *` object. Remember to pass in the address of the +C-variables that should be filled in. + +There are lots of examples of how to use :cfunc:`PyArg_ParseTuple` +throughout the NumPy source code. The standard usage is like this: + +.. code-block:: c + + PyObject *input; + PyArray_Descr *dtype; + if (!PyArg_ParseTuple(args, "OO&", &input, + PyArray_DescrConverter, + &dtype)) return NULL; + +It is important to keep in mind that you get a *borrowed* reference to +the object when using the "O" format string. However, the converter +functions usually require some form of memory handling. In this +example, if the conversion is successful, *dtype* will hold a new +reference to a :ctype:`PyArray_Descr *` object, while *input* will hold a +borrowed reference. Therefore, if this conversion were mixed with +another conversion (say to an integer) and the data-type conversion +was successful but the integer conversion failed, then you would need +to release the reference count to the data-type object before +returning. A typical way to do this is to set *dtype* to ``NULL`` +before calling :cfunc:`PyArg_ParseTuple` and then use :cfunc:`Py_XDECREF` +on *dtype* before returning. + +After the input arguments are processed, the code that actually does +the work is written (likely calling other functions as needed). The +final step of the C-function is to return something. If an error is +encountered then ``NULL`` should be returned (making sure an error has +actually been set). If nothing should be returned then increment +:cdata:`Py_None` and return it. If a single object should be returned then +it is returned (ensuring that you own a reference to it first). If +multiple objects should be returned then you need to return a tuple. +The :cfunc:`Py_BuildValue` (format_string, c_variables...) function makes +it easy to build tuples of Python objects from C variables. Pay +special attention to the difference between 'N' and 'O' in the format +string or you can easily create memory leaks. The 'O' format string +increments the reference count of the :ctype:`PyObject *` C-variable it +corresponds to, while the 'N' format string steals a reference to the +corresponding :ctype:`PyObject *` C-variable. You should use 'N' if you ave +already created a reference for the object and just want to give that +reference to the tuple. You should use 'O' if you only have a borrowed +reference to an object and need to create one to provide for the +tuple. + + +Functions with keyword arguments +-------------------------------- + +These functions are very similar to functions without keyword +arguments. The only difference is that the function signature is: + +.. code-block:: c + + static PyObject* + keyword_cfunc (PyObject *dummy, PyObject *args, PyObject *kwds) + { + ... + } + +The kwds argument holds a Python dictionary whose keys are the names +of the keyword arguments and whose values are the corresponding +keyword-argument values. This dictionary can be processed however you +see fit. The easiest way to handle it, however, is to replace the +:cfunc:`PyArg_ParseTuple` (args, format_string, addresses...) function with +a call to :cfunc:`PyArg_ParseTupleAndKeywords` (args, kwds, format_string, +char \*kwlist[], addresses...). The kwlist parameter to this function +is a ``NULL`` -terminated array of strings providing the expected +keyword arguments. There should be one string for each entry in the +format_string. Using this function will raise a TypeError if invalid +keyword arguments are passed in. + +For more help on this function please see section 1.8 (Keyword +Paramters for Extension Functions) of the Extending and Embedding +tutorial in the Python documentation. + + +Reference counting +------------------ + +The biggest difficulty when writing extension modules is reference +counting. It is an important reason for the popularity of f2py, weave, +pyrex, ctypes, etc.... If you mis-handle reference counts you can get +problems from memory-leaks to segmentation faults. The only strategy I +know of to handle reference counts correctly is blood, sweat, and +tears. First, you force it into your head that every Python variable +has a reference count. Then, you understand exactly what each function +does to the reference count of your objects, so that you can properly +use DECREF and INCREF when you need them. Reference counting can +really test the amount of patience and diligence you have towards your +programming craft. Despite the grim depiction, most cases of reference +counting are quite straightforward with the most common difficulty +being not using DECREF on objects before exiting early from a routine +due to some error. In second place, is the common error of not owning +the reference on an object that is passed to a function or macro that +is going to steal the reference ( *e.g.* :cfunc:`PyTuple_SET_ITEM`, and +most functions that take :ctype:`PyArray_Descr` objects). + +.. index:: + single: reference counting + +Typically you get a new reference to a variable when it is created or +is the return value of some function (there are some prominent +exceptions, however --- such as getting an item out of a tuple or a +dictionary). When you own the reference, you are responsible to make +sure that :cfunc:`Py_DECREF` (var) is called when the variable is no +longer necessary (and no other function has "stolen" its +reference). Also, if you are passing a Python object to a function +that will "steal" the reference, then you need to make sure you own it +(or use :cfunc:`Py_INCREF` to get your own reference). You will also +encounter the notion of borrowing a reference. A function that borrows +a reference does not alter the reference count of the object and does +not expect to "hold on "to the reference. It's just going to use the +object temporarily. When you use :cfunc:`PyArg_ParseTuple` or +:cfunc:`PyArg_UnpackTuple` you receive a borrowed reference to the +objects in the tuple and should not alter their reference count inside +your function. With practice, you can learn to get reference counting +right, but it can be frustrating at first. + +One common source of reference-count errors is the :cfunc:`Py_BuildValue` +function. Pay careful attention to the difference between the 'N' +format character and the 'O' format character. If you create a new +object in your subroutine (such as an output array), and you are +passing it back in a tuple of return values, then you should most- +likely use the 'N' format character in :cfunc:`Py_BuildValue`. The 'O' +character will increase the reference count by one. This will leave +the caller with two reference counts for a brand-new array. When the +variable is deleted and the reference count decremented by one, there +will still be that extra reference count, and the array will never be +deallocated. You will have a reference-counting induced memory leak. +Using the 'N' character will avoid this situation as it will return to +the caller an object (inside the tuple) with a single reference count. + +.. index:: + single: reference counting + + + + +Dealing with array objects +========================== + +Most extension modules for NumPy will need to access the memory for an +ndarray object (or one of it's sub-classes). The easiest way to do +this doesn't require you to know much about the internals of NumPy. +The method is to + +1. Ensure you are dealing with a well-behaved array (aligned, in machine + byte-order and single-segment) of the correct type and number of + dimensions. + + 1. By converting it from some Python object using + :cfunc:`PyArray_FromAny` or a macro built on it. + + 2. By constructing a new ndarray of your desired shape and type + using :cfunc:`PyArray_NewFromDescr` or a simpler macro or function + based on it. + + +2. Get the shape of the array and a pointer to its actual data. + +3. Pass the data and shape information on to a subroutine or other + section of code that actually performs the computation. + +4. If you are writing the algorithm, then I recommend that you use the + stride information contained in the array to access the elements of + the array (the :cfunc:`PyArray_GETPTR` macros make this painless). Then, + you can relax your requirements so as not to force a single-segment + array and the data-copying that might result. + +Each of these sub-topics is covered in the following sub-sections. + + +Converting an arbitrary sequence object +--------------------------------------- + +The main routine for obtaining an array from any Python object that +can be converted to an array is :cfunc:`PyArray_FromAny`. This +function is very flexible with many input arguments. Several macros +make it easier to use the basic function. :cfunc:`PyArray_FROM_OTF` is +arguably the most useful of these macros for the most common uses. It +allows you to convert an arbitrary Python object to an array of a +specific builtin data-type ( *e.g.* float), while specifying a +particular set of requirements ( *e.g.* contiguous, aligned, and +writeable). The syntax is + +.. cfunction:: PyObject *PyArray_FROM_OTF(PyObject* obj, int typenum, int requirements) + + Return an ndarray from any Python object, *obj*, that can be + converted to an array. The number of dimensions in the returned + array is determined by the object. The desired data-type of the + returned array is provided in *typenum* which should be one of the + enumerated types. The *requirements* for the returned array can be + any combination of standard array flags. Each of these arguments + is explained in more detail below. You receive a new reference to + the array on success. On failure, ``NULL`` is returned and an + exception is set. + + *obj* + + The object can be any Python object convertable to an ndarray. + If the object is already (a subclass of) the ndarray that + satisfies the requirements then a new reference is returned. + Otherwise, a new array is constructed. The contents of *obj* + are copied to the new array unless the array interface is used + so that data does not have to be copied. Objects that can be + converted to an array include: 1) any nested sequence object, + 2) any object exposing the array interface, 3) any object with + an :obj:`__array__` method (which should return an ndarray), + and 4) any scalar object (becomes a zero-dimensional + array). Sub-classes of the ndarray that otherwise fit the + requirements will be passed through. If you want to ensure + a base-class ndarray, then use :cdata:`NPY_ENSUREARRAY` in the + requirements flag. A copy is made only if necessary. If you + want to guarantee a copy, then pass in :cdata:`NPY_ENSURECOPY` + to the requirements flag. + + *typenum* + + One of the enumerated types or :cdata:`NPY_NOTYPE` if the data-type + should be determined from the object itself. The C-based names + can be used: + + :cdata:`NPY_BOOL`, :cdata:`NPY_BYTE`, :cdata:`NPY_UBYTE`, + :cdata:`NPY_SHORT`, :cdata:`NPY_USHORT`, :cdata:`NPY_INT`, + :cdata:`NPY_UINT`, :cdata:`NPY_LONG`, :cdata:`NPY_ULONG`, + :cdata:`NPY_LONGLONG`, :cdata:`NPY_ULONGLONG`, :cdata:`NPY_DOUBLE`, + :cdata:`NPY_LONGDOUBLE`, :cdata:`NPY_CFLOAT`, :cdata:`NPY_CDOUBLE`, + :cdata:`NPY_CLONGDOUBLE`, :cdata:`NPY_OBJECT`. + + Alternatively, the bit-width names can be used as supported on the + platform. For example: + + :cdata:`NPY_INT8`, :cdata:`NPY_INT16`, :cdata:`NPY_INT32`, + :cdata:`NPY_INT64`, :cdata:`NPY_UINT8`, + :cdata:`NPY_UINT16`, :cdata:`NPY_UINT32`, + :cdata:`NPY_UINT64`, :cdata:`NPY_FLOAT32`, + :cdata:`NPY_FLOAT64`, :cdata:`NPY_COMPLEX64`, + :cdata:`NPY_COMPLEX128`. + + The object will be converted to the desired type only if it + can be done without losing precision. Otherwise ``NULL`` will + be returned and an error raised. Use :cdata:`NPY_FORCECAST` in the + requirements flag to override this behavior. + + *requirements* + + The memory model for an ndarray admits arbitrary strides in + each dimension to advance to the next element of the array. + Often, however, you need to interface with code that expects a + C-contiguous or a Fortran-contiguous memory layout. In + addition, an ndarray can be misaligned (the address of an + element is not at an integral multiple of the size of the + element) which can cause your program to crash (or at least + work more slowly) if you try and dereference a pointer into + the array data. Both of these problems can be solved by + converting the Python object into an array that is more + "well-behaved" for your specific usage. + + The requirements flag allows specification of what kind of array is + acceptable. If the object passed in does not satisfy this requirements + then a copy is made so that thre returned object will satisfy the + requirements. these ndarray can use a very generic pointer to memory. + This flag allows specification of the desired properties of the + returned array object. All of the flags are explained in the detailed + API chapter. The flags most commonly needed are :cdata:`NPY_IN_ARRAY`, + :cdata:`NPY_OUT_ARRAY`, and :cdata:`NPY_INOUT_ARRAY`: + + .. cvar:: NPY_IN_ARRAY + + Equivalent to :cdata:`NPY_CONTIGUOUS` \| + :cdata:`NPY_ALIGNED`. This combination of flags is useful + for arrays that must be in C-contiguous order and aligned. + These kinds of arrays are usually input arrays for some + algorithm. + + .. cvar:: NPY_OUT_ARRAY + + Equivalent to :cdata:`NPY_CONTIGUOUS` \| + :cdata:`NPY_ALIGNED` \| :cdata:`NPY_WRITEABLE`. This + combination of flags is useful to specify an array that is + in C-contiguous order, is aligned, and can be written to + as well. Such an array is usually returned as output + (although normally such output arrays are created from + scratch). + + .. cvar:: NPY_INOUT_ARRAY + + Equivalent to :cdata:`NPY_CONTIGUOUS` \| + :cdata:`NPY_ALIGNED` \| :cdata:`NPY_WRITEABLE` \| + :cdata:`NPY_UPDATEIFCOPY`. This combination of flags is + useful to specify an array that will be used for both + input and output. If a copy is needed, then when the + temporary is deleted (by your use of :cfunc:`Py_DECREF` at + the end of the interface routine), the temporary array + will be copied back into the original array passed in. Use + of the :cdata:`UPDATEIFCOPY` flag requires that the input + object is already an array (because other objects cannot + be automatically updated in this fashion). If an error + occurs use :cfunc:`PyArray_DECREF_ERR` (obj) on an array + with the :cdata:`NPY_UPDATEIFCOPY` flag set. This will + delete the array without causing the contents to be copied + back into the original array. + + + Other useful flags that can be OR'd as additional requirements are: + + .. cvar:: NPY_FORCECAST + + Cast to the desired type, even if it can't be done without losing + information. + + .. cvar:: NPY_ENSURECOPY + + Make sure the resulting array is a copy of the original. + + .. cvar:: NPY_ENSUREARRAY + + Make sure the resulting object is an actual ndarray and not a sub- + class. + +.. note:: + + Whether or not an array is byte-swapped is determined by the + data-type of the array. Native byte-order arrays are always + requested by :cfunc:`PyArray_FROM_OTF` and so there is no need for + a :cdata:`NPY_NOTSWAPPED` flag in the requirements argument. There + is also no way to get a byte-swapped array from this routine. + + +Creating a brand-new ndarray +---------------------------- + +Quite often new arrays must be created from within extension-module +code. Perhaps an output array is needed and you don't want the caller +to have to supply it. Perhaps only a temporary array is needed to hold +an intermediate calculation. Whatever the need there are simple ways +to get an ndarray object of whatever data-type is needed. The most +general function for doing this is :cfunc:`PyArray_NewFromDescr`. All array +creation functions go through this heavily re-used code. Because of +its flexibility, it can be somewhat confusing to use. As a result, +simpler forms exist that are easier to use. + +.. cfunction:: PyObject *PyArray_SimpleNew(int nd, npy_intp* dims, int typenum) + + This function allocates new memory and places it in an ndarray + with *nd* dimensions whose shape is determined by the array of + at least *nd* items pointed to by *dims*. The memory for the + array is uninitialized (unless typenum is :cdata:`PyArray_OBJECT` in + which case each element in the array is set to NULL). The + *typenum* argument allows specification of any of the builtin + data-types such as :cdata:`PyArray_FLOAT` or :cdata:`PyArray_LONG`. The + memory for the array can be set to zero if desired using + :cfunc:`PyArray_FILLWBYTE` (return_object, 0). + +.. cfunction:: PyObject *PyArray_SimpleNewFromData( int nd, npy_intp* dims, int typenum, void* data) + + Sometimes, you want to wrap memory allocated elsewhere into an + ndarray object for downstream use. This routine makes it + straightforward to do that. The first three arguments are the same + as in :cfunc:`PyArray_SimpleNew`, the final argument is a pointer to a + block of contiguous memory that the ndarray should use as it's + data-buffer which will be interpreted in C-style contiguous + fashion. A new reference to an ndarray is returned, but the + ndarray will not own its data. When this ndarray is deallocated, + the pointer will not be freed. + + You should ensure that the provided memory is not freed while the + returned array is in existence. The easiest way to handle this is + if data comes from another reference-counted Python object. The + reference count on this object should be increased after the + pointer is passed in, and the base member of the returned ndarray + should point to the Python object that owns the data. Then, when + the ndarray is deallocated, the base-member will be DECREF'd + appropriately. If you want the memory to be freed as soon as the + ndarray is deallocated then simply set the OWNDATA flag on the + returned ndarray. + + +Getting at ndarray memory and accessing elements of the ndarray +--------------------------------------------------------------- + +If obj is an ndarray (:ctype:`PyArrayObject *`), then the data-area of the +ndarray is pointed to by the void* pointer :cfunc:`PyArray_DATA` (obj) or +the char* pointer :cfunc:`PyArray_BYTES` (obj). Remember that (in general) +this data-area may not be aligned according to the data-type, it may +represent byte-swapped data, and/or it may not be writeable. If the +data area is aligned and in native byte-order, then how to get at a +specific element of the array is determined only by the array of +npy_intp variables, :cfunc:`PyArray_STRIDES` (obj). In particular, this +c-array of integers shows how many **bytes** must be added to the +current element pointer to get to the next element in each dimension. +For arrays less than 4-dimensions there are :cfunc:`PyArray_GETPTR{k}` +(obj, ...) macros where {k} is the integer 1, 2, 3, or 4 that make +using the array strides easier. The arguments .... represent {k} non- +negative integer indices into the array. For example, suppose ``E`` is +a 3-dimensional ndarray. A (void*) pointer to the element ``E[i,j,k]`` +is obtained as :cfunc:`PyArray_GETPTR3` (E, i, j, k). + +As explained previously, C-style contiguous arrays and Fortran-style +contiguous arrays have particular striding patterns. Two array flags +(:cdata:`NPY_C_CONTIGUOUS` and :cdata`NPY_F_CONTIGUOUS`) indicate +whether or not the striding pattern of a particular array matches the +C-style contiguous or Fortran-style contiguous or neither. Whether or +not the striding pattern matches a standard C or Fortran one can be +tested Using :cfunc:`PyArray_ISCONTIGUOUS` (obj) and +:cfunc:`PyArray_ISFORTRAN` (obj) respectively. Most third-party +libraries expect contiguous arrays. But, often it is not difficult to +support general-purpose striding. I encourage you to use the striding +information in your own code whenever possible, and reserve +single-segment requirements for wrapping third-party code. Using the +striding information provided with the ndarray rather than requiring a +contiguous striding reduces copying that otherwise must be made. + + +Example +======= + +.. index:: + single: extension module + +The following example shows how you might write a wrapper that accepts +two input arguments (that will be converted to an array) and an output +argument (that must be an array). The function returns None and +updates the output array. + +.. code-block:: c + + static PyObject * + example_wrapper(PyObject *dummy, PyObject *args) + { + PyObject *arg1=NULL, *arg2=NULL, *out=NULL; + PyObject *arr1=NULL, *arr2=NULL, *oarr=NULL; + + if (!PyArg_ParseTuple(args, OOO&, &arg1, *arg2, + &PyArrayType, *out)) return NULL; + + arr1 = PyArray_FROM_OTF(arg1, NPY_DOUBLE, NPY_IN_ARRAY); + if (arr1 == NULL) return NULL; + arr2 = PyArray_FROM_OTF(arg2, NPY_DOUBLE, NPY_IN_ARRAY); + if (arr2 == NULL) goto fail; + oarr = PyArray_FROM_OTF(out, NPY_DOUBLE, NPY_INOUT_ARRAY); + if (oarr == NULL) goto fail; + + /* code that makes use of arguments */ + /* You will probably need at least + nd = PyArray_NDIM(<..>) -- number of dimensions + dims = PyArray_DIMS(<..>) -- npy_intp array of length nd + showing length in each dim. + dptr = (double *)PyArray_DATA(<..>) -- pointer to data. + + If an error occurs goto fail. + */ + + Py_DECREF(arr1); + Py_DECREF(arr2); + Py_DECREF(oarr); + Py_INCREF(Py_None); + return Py_None; + + fail: + Py_XDECREF(arr1); + Py_XDECREF(arr2); + PyArray_XDECREF_ERR(oarr); + return NULL; + } Added: numpy-docs/trunk/source/user/c-info.python-as-glue.rst =================================================================== --- numpy-docs/trunk/source/user/c-info.python-as-glue.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/c-info.python-as-glue.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,1523 @@ +******************** +Using Python as glue +******************** + +| There is no conversation more boring than the one where everybody +| agrees. +| --- *Michel de Montaigne* + +| Duct tape is like the force. It has a light side, and a dark side, and +| it holds the universe together. +| --- *Carl Zwanzig* + +Many people like to say that Python is a fantastic glue language. +Hopefully, this Chapter will convince you that this is true. The first +adopters of Python for science were typically people who used it to +glue together large applicaton codes running on super-computers. Not +only was it much nicer to code in Python than in a shell script or +Perl, in addition, the ability to easily extend Python made it +relatively easy to create new classes and types specifically adapted +to the problems being solved. From the interactions of these early +contributors, Numeric emerged as an array-like object that could be +used to pass data between these applications. + +As Numeric has matured and developed into NumPy, people have been able +to write more code directly in NumPy. Often this code is fast-enough +for production use, but there are still times that there is a need to +access compiled code. Either to get that last bit of efficiency out of +the algorithm or to make it easier to access widely-available codes +written in C/C++ or Fortran. + +This chapter will review many of the tools that are available for the +purpose of accessing code written in other compiled languages. There +are many resources available for learning to call other compiled +libraries from Python and the purpose of this Chapter is not to make +you an expert. The main goal is to make you aware of some of the +possibilities so that you will know what to "Google" in order to learn more. + +The http://www.scipy.org website also contains a great deal of useful +information about many of these tools. For example, there is a nice +description of using several of the tools explained in this chapter at +http://www.scipy.org/PerformancePython. This link provides several +ways to solve the same problem showing how to use and connect with +compiled code to get the best performance. In the process you can get +a taste for several of the approaches that will be discussed in this +chapter. + + +Calling other compiled libraries from Python +============================================ + +While Python is a great language and a pleasure to code in, its +dynamic nature results in overhead that can cause some code ( *i.e.* +raw computations inside of for loops) to be up 10-100 times slower +than equivalent code written in a static compiled language. In +addition, it can cause memory usage to be larger than necessary as +temporary arrays are created and destroyed during computation. For +many types of computing needs the extra slow-down and memory +consumption can often not be spared (at least for time- or memory- +critical portions of your code). Therefore one of the most common +needs is to call out from Python code to a fast, machine-code routine +(e.g. compiled using C/C++ or Fortran). The fact that this is +relatively easy to do is a big reason why Python is such an excellent +high-level language for scientific and engineering programming. + +Their are two basic approaches to calling compiled code: writing an +extension module that is then imported to Python using the import +command, or calling a shared-library subroutine directly from Python +using the ctypes module (included in the standard distribution with +Python 2.5). The first method is the most common (but with the +inclusion of ctypes into Python 2.5 this status may change). + +.. warning:: + + Calling C-code from Python can result in Python crashes if you are not + careful. None of the approaches in this chapter are immune. You have + to know something about the way data is handled by both NumPy and by + the third-party library being used. + + +Hand-generated wrappers +======================= + +Extension modules were discussed in Chapter `1 +<#sec-writing-an-extension>`__ . The most basic way to interface with +compiled code is to write an extension module and construct a module +method that calls the compiled code. For improved readability, your +method should take advantage of the PyArg_ParseTuple call to convert +between Python objects and C data-types. For standard C data-types +there is probably already a built-in converter. For others you may +need to write your own converter and use the "O&" format string which +allows you to specify a function that will be used to perform the +conversion from the Python object to whatever C-structures are needed. + +Once the conversions to the appropriate C-structures and C data-types +have been performed, the next step in the wrapper is to call the +underlying function. This is straightforward if the underlying +function is in C or C++. However, in order to call Fortran code you +must be familiar with how Fortran subroutines are called from C/C++ +using your compiler and platform. This can vary somewhat platforms and +compilers (which is another reason f2py makes life much simpler for +interfacing Fortran code) but generally involves underscore mangling +of the name and the fact that all variables are passed by reference +(i.e. all arguments are pointers). + +The advantage of the hand-generated wrapper is that you have complete +control over how the C-library gets used and called which can lead to +a lean and tight interface with minimal over-head. The disadvantage is +that you have to write, debug, and maintain C-code, although most of +it can be adapted using the time-honored technique of +"cutting-pasting-and-modifying" from other extension modules. Because, +the procedure of calling out to additional C-code is fairly +regimented, code-generation procedures have been developed to make +this process easier. One of these code- generation techniques is +distributed with NumPy and allows easy integration with Fortran and +(simple) C code. This package, f2py, will be covered briefly in the +next session. + + +f2py +==== + +F2py allows you to automatically construct an extension module that +interfaces to routines in Fortran 77/90/95 code. It has the ability to +parse Fortran 77/90/95 code and automatically generate Python +signatures for the subroutines it encounters, or you can guide how the +subroutine interfaces with Python by constructing an interface- +defintion-file (or modifying the f2py-produced one). + +.. index:: + single: f2py + +Creating source for a basic extension module +-------------------------------------------- + +Probably the easiest way to introduce f2py is to offer a simple +example. Here is one of the subroutines contained in a file named +:file:`add.f`: + +.. code-block:: none + + C + SUBROUTINE ZADD(A,B,C,N) + C + DOUBLE COMPLEX A(*) + DOUBLE COMPLEX B(*) + DOUBLE COMPLEX C(*) + INTEGER N + DO 20 J = 1, N + C(J) = A(J)+B(J) + 20 CONTINUE + END + +This routine simply adds the elements in two contiguous arrays and +places the result in a third. The memory for all three arrays must be +provided by the calling routine. A very basic interface to this +routine can be automatically generated by f2py:: + + f2py -m add add.f + +You should be able to run this command assuming your search-path is +set-up properly. This command will produce an extension module named +addmodule.c in the current directory. This extension module can now be +compiled and used from Python just like any other extension module. + + +Creating a compiled extension module +------------------------------------ + +You can also get f2py to compile add.f and also compile its produced +extension module leaving only a shared-library extension file that can +be imported from Python:: + + f2py -c -m add add.f + +This command leaves a file named add.{ext} in the current directory +(where {ext} is the appropriate extension for a python extension +module on your platform --- so, pyd, *etc.* ). This module may then be +imported from Python. It will contain a method for each subroutin in +add (zadd, cadd, dadd, sadd). The docstring of each method contains +information about how the module method may be called: + + >>> import add + >>> print add.zadd.__doc__ + zadd - Function signature: + zadd(a,b,c,n) + Required arguments: + a : input rank-1 array('D') with bounds (*) + b : input rank-1 array('D') with bounds (*) + c : input rank-1 array('D') with bounds (*) + n : input int + + +Improving the basic interface +----------------------------- + +The default interface is a very literal translation of the fortran +code into Python. The Fortran array arguments must now be NumPy arrays +and the integer argument should be an integer. The interface will +attempt to convert all arguments to their required types (and shapes) +and issue an error if unsuccessful. However, because it knows nothing +about the semantics of the arguments (such that C is an output and n +should really match the array sizes), it is possible to abuse this +function in ways that can cause Python to crash. For example: + + >>> add.zadd([1,2,3],[1,2],[3,4],1000) + +will cause a program crash on most systems. Under the covers, the +lists are being converted to proper arrays but then the underlying add +loop is told to cycle way beyond the borders of the allocated memory. + +In order to improve the interface, directives should be provided. This +is accomplished by constructing an interface definition file. It is +usually best to start from the interface file that f2py can produce +(where it gets its default behavior from). To get f2py to generate the +interface file use the -h option:: + + f2py -h add.pyf -m add add.f + +This command leaves the file add.pyf in the current directory. The +section of this file corresponding to zadd is: + +.. code-block:: none + + subroutine zadd(a,b,c,n) ! in :add:add.f + double complex dimension(*) :: a + double complex dimension(*) :: b + double complex dimension(*) :: c + integer :: n + end subroutine zadd + +By placing intent directives and checking code, the interface can be +cleaned up quite a bit until the Python module method is both easier +to use and more robust. + +.. code-block:: none + + subroutine zadd(a,b,c,n) ! in :add:add.f + double complex dimension(n) :: a + double complex dimension(n) :: b + double complex intent(out),dimension(n) :: c + integer intent(hide),depend(a) :: n=len(a) + end subroutine zadd + +The intent directive, intent(out) is used to tell f2py that ``c`` is +an output variable and should be created by the interface before being +passed to the underlying code. The intent(hide) directive tells f2py +to not allow the user to specify the variable, ``n``, but instead to +get it from the size of ``a``. The depend( ``a`` ) directive is +necessary to tell f2py that the value of n depends on the input a (so +that it won't try to create the variable n until the variable a is +created). + +The new interface has docstring: + + >>> print add.zadd.__doc__ + zadd - Function signature: + c = zadd(a,b) + Required arguments: + a : input rank-1 array('D') with bounds (n) + b : input rank-1 array('D') with bounds (n) + Return objects: + c : rank-1 array('D') with bounds (n) + +Now, the function can be called in a much more robust way: + + >>> add.zadd([1,2,3],[4,5,6]) + array([ 5.+0.j, 7.+0.j, 9.+0.j]) + +Notice the automatic conversion to the correct format that occurred. + + +Inserting directives in Fortran source +-------------------------------------- + +The nice interface can also be generated automatically by placing the +variable directives as special comments in the original fortran code. +Thus, if I modify the source code to contain: + +.. code-block:: none + + C + SUBROUTINE ZADD(A,B,C,N) + C + CF2PY INTENT(OUT) :: C + CF2PY INTENT(HIDE) :: N + CF2PY DOUBLE COMPLEX :: A(N) + CF2PY DOUBLE COMPLEX :: B(N) + CF2PY DOUBLE COMPLEX :: C(N) + DOUBLE COMPLEX A(*) + DOUBLE COMPLEX B(*) + DOUBLE COMPLEX C(*) + INTEGER N + DO 20 J = 1, N + C(J) = A(J) + B(J) + 20 CONTINUE + END + +Then, I can compile the extension module using:: + + f2py -c -m add add.f + +The resulting signature for the function add.zadd is exactly the same +one that was created previously. If the original source code had +contained A(N) instead of A(\*) and so forth with B and C, then I +could obtain (nearly) the same interface simply by placing the +INTENT(OUT) :: C comment line in the source code. The only difference +is that N would be an optional input that would default to the length +of A. + + +A filtering example +------------------- + +For comparison with the other methods to be discussed. Here is another +example of a function that filters a two-dimensional array of double +precision floating-point numbers using a fixed averaging filter. The +advantage of using Fortran to index into multi-dimensional arrays +should be clear from this example. + +.. code-block:: none + + SUBROUTINE DFILTER2D(A,B,M,N) + C + DOUBLE PRECISION A(M,N) + DOUBLE PRECISION B(M,N) + INTEGER N, M + CF2PY INTENT(OUT) :: B + CF2PY INTENT(HIDE) :: N + CF2PY INTENT(HIDE) :: M + DO 20 I = 2,M-1 + DO 40 J=2,N-1 + B(I,J) = A(I,J) + + $ (A(I-1,J)+A(I+1,J) + + $ A(I,J-1)+A(I,J+1) )*0.5D0 + + $ (A(I-1,J-1) + A(I-1,J+1) + + $ A(I+1,J-1) + A(I+1,J+1))*0.25D0 + 40 CONTINUE + 20 CONTINUE + END + +This code can be compiled and linked into an extension module named +filter using:: + + f2py -c -m filter filter.f + +This will produce an extension module named filter.so in the current +directory with a method named dfilter2d that returns a filtered +version of the input. + + +Calling f2py from Python +------------------------ + +The f2py program is written in Python and can be run from inside your +module. This provides a facility that is somewhat similar to the use +of weave.ext_tools described below. An example of the final interface +executed using Python code is: + +.. code-block:: python + + import numpy.f2py as f2py + fid = open('add.f') + source = fid.read() + fid.close() + f2py.compile(source, modulename='add') + import add + +The source string can be any valid Fortran code. If you want to save +the extension-module source code then a suitable file-name can be +provided by the source_fn keyword to the compile function. + + +Automatic extension module generation +------------------------------------- + +If you want to distribute your f2py extension module, then you only +need to include the .pyf file and the Fortran code. The distutils +extensions in NumPy allow you to define an extension module entirely +in terms of this interface file. A valid setup.py file allowing +distribution of the add.f module (as part of the package f2py_examples +so that it would be loaded as f2py_examples.add) is: + +.. code-block:: python + + def configuration(parent_package='', top_path=None) + from numpy.distutils.misc_util import Configuration + config = Configuration('f2py_examples',parent_package, top_path) + config.add_extension('add', sources=['add.pyf','add.f']) + return config + + if __name__ == '__main__': + from numpy.distutils.core import setup + setup(**configuration(top_path='').todict()) + +Installation of the new package is easy using:: + + python setup.py install + +assuming you have the proper permissions to write to the main site- +packages directory for the version of Python you are using. For the +resulting package to work, you need to create a file named __init__.py +(in the same directory as add.pyf). Notice the extension module is +defined entirely in terms of the "add.pyf" and "add.f" files. The +conversion of the .pyf file to a .c file is handled by numpy.disutils. + + +Conclusion +---------- + +The interface definition file (.pyf) is how you can fine-tune the +interface between Python and Fortran. There is decent documentation +for f2py found in the numpy/f2py/docs directory where-ever NumPy is +installed on your system (usually under site-packages). There is also +more information on using f2py (including how to use it to wrap C +codes) at http://www.scipy.org/Cookbook under the "Using NumPy with +Other Languages" heading. + +The f2py method of linking compiled code is currently the most +sophisticated and integrated approach. It allows clean separation of +Python with compiled code while still allowing for separate +distribution of the extension module. The only draw-back is that it +requires the existence of a Fortran compiler in order for a user to +install the code. However, with the existence of the free-compilers +g77, gfortran, and g95, as well as high-quality commerical compilers, +this restriction is not particularly onerous. In my opinion, Fortran +is still the easiest way to write fast and clear code for scientific +computing. It handles complex numbers, and multi-dimensional indexing +in the most straightforward way. Be aware, however, that some Fortran +compilers will not be able to optimize code as well as good hand- +written C-code. + +.. index:: + single: f2py + + +weave +===== + +Weave is a scipy package that can be used to automate the process of +extending Python with C/C++ code. It can be used to speed up +evaluation of an array expression that would otherwise create +temporary variables, to directly "inline" C/C++ code into Python, or +to create a fully-named extension module. You must either install +scipy or get the weave package separately and install it using the +standard python setup.py install. You must also have a C/C++-compiler +installed and useable by Python distutils in order to use weave. + +.. index:: + single: weave + +Somewhat dated, but still useful documentation for weave can be found +at the link http://www.scipy/Weave. There are also many examples found +in the examples directory which is installed under the weave directory +in the place where weave is installed on your system. + + +Speed up code involving arrays (also see scipy.numexpr) +------------------------------------------------------- + +This is the easiest way to use weave and requires minimal changes to +your Python code. It involves placing quotes around the expression of +interest and calling weave.blitz. Weave will parse the code and +generate C++ code using Blitz C++ arrays. It will then compile the +code and catalog the shared library so that the next time this exact +string is asked for (and the array types are the same), the already- +compiled shared library will be loaded and used. Because Blitz makes +extensive use of C++ templating, it can take a long time to compile +the first time. After that, however, the code should evaluate more +quickly than the equivalent NumPy expression. This is especially true +if your array sizes are large and the expression would require NumPy +to create several temporaries. Only expressions involving basic +arithmetic operations and basic array slicing can be converted to +Blitz C++ code. + +For example, consider the expression:: + + d = 4*a + 5*a*b + 6*b*c + +where a, b, and c are all arrays of the same type and shape. When the +data-type is double-precision and the size is 1000x1000, this +expression takes about 0.5 seconds to compute on an 1.1Ghz AMD Athlon +machine. When this expression is executed instead using blitz: + +.. code-block:: python + + d = empty(a.shape, 'd'); weave.blitz(expr) + +execution time is only about 0.20 seconds (about 0.14 seconds spent in +weave and the rest in allocating space for d). Thus, we've sped up the +code by a factor of 2 using only a simnple command (weave.blitz). Your +mileage may vary, but factors of 2-8 speed-ups are possible with this +very simple technique. + +If you are interested in using weave in this way, then you should also +look at scipy.numexpr which is another similar way to speed up +expressions by eliminating the need for temporary variables. Using +numexpr does not require a C/C++ compiler. + + +Inline C-code +------------- + +Probably the most widely-used method of employing weave is to +"in-line" C/C++ code into Python in order to speed up a time-critical +section of Python code. In this method of using weave, you define a +string containing useful C-code and then pass it to the function +**weave.inline** ( ``code_string``, ``variables`` ), where +code_string is a string of valid C/C++ code and variables is a list of +variables that should be passed in from Python. The C/C++ code should +refer to the variables with the same names as they are defined with in +Python. If weave.line should return anything the the special value +return_val should be set to whatever object should be returned. The +following example shows how to use weave on basic Python objects: + +.. code-block:: python + + code = r""" + int i; + py::tuple results(2); + for (i=0; ic.data)[i].real = \ + (a.data)[i].real + \ + (b.data)[i].real + (c.data)[i].imag = \ + (a.data)[i].imag + \ + (b.data)[i].imag + return c + +This module shows use of the ``cimport`` statement to load the +definitions from the c_numpy.pxd file. As shown, both versions of the +import statement are supported. It also shows use of the NumPy C-API +to construct NumPy arrays from arbitrary input objects. The array c is +created using PyArray_SimpleNew. Then the c-array is filled by +addition. Casting to a particiular data-type is accomplished using +. Pointers are de-referenced with bracket notation and +members of structures are accessed using '.' notation even if the +object is techinically a pointer to a structure. The use of the +special for loop construct ensures that the underlying code will have +a similar C-loop so the addition calculation will proceed quickly. +Notice that we have not checked for NULL after calling to the C-API +--- a cardinal sin when writing C-code. For routines that return +Python objects, Pyrex inserts the checks for NULL into the C-code for +you and returns with failure if need be. There is also a way to get +Pyrex to automatically check for exceptions when you call functions +that don't return Python objects. See the documentation of Pyrex for +details. + + +Pyrex-filter +------------ + +The two-dimensional example we created using weave is a bit uglierto +implement in Pyrex because two-dimensional indexing using Pyrex is not +as simple. But, it is straightforward (and possibly faster because of +pre-computed indices). Here is the Pyrex-file I named image.pyx. + +.. code-block:: none + + cimport c_numpy + from c_numpy cimport import_array, ndarray, npy_intp,\ + NPY_DOUBLE, NPY_CDOUBLE, \ + NPY_FLOAT, NPY_CFLOAT, NPY_ALIGNED \ + + #We need to initialize NumPy + import_array() + def filter(object ao): + cdef ndarray a, b + cdef npy_intp i, j, M, N, oS + cdef npy_intp r,rm1,rp1,c,cm1,cp1 + cdef double value + # Require an ALIGNED array + # (but not necessarily contiguous) + # We will use strides to access the elements. + a = c_numpy.PyArray_FROMANY(ao, NPY_DOUBLE, \ + 2, 2, NPY_ALIGNED) + b = c_numpy.PyArray_SimpleNew(a.nd,a.dimensions, \ + a.descr.type_num) + M = a.dimensions[0] + N = a.dimensions[1] + S0 = a.strides[0] + S1 = a.strides[1] + for i from 1 <= i < M-1: + r = i*S0 + rm1 = r-S0 + rp1 = r+S0 + oS = i*N + for j from 1 <= j < N-1: + c = j*S1 + cm1 = c-S1 + cp1 = c+S1 + (b.data)[oS+j] = \ + ((a.data+r+c))[0] + \ + (((a.data+rm1+c))[0] + \ + ((a.data+rp1+c))[0] + \ + ((a.data+r+cm1))[0] + \ + ((a.data+r+cp1))[0])*0.5 + \ + (((a.data+rm1+cm1))[0] + \ + ((a.data+rp1+cm1))[0] + \ + ((a.data+rp1+cp1))[0] + \ + ((a.data+rm1+cp1))[0])*0.25 + return b + +This 2-d averaging filter runs quickly because the loop is in C and +the pointer computations are done only as needed. However, it is not +particularly easy to understand what is happening. A 2-d image, ``in`` +, can be filtered using this code very quickly using: + +.. code-block:: python + + import image + out = image.filter(in) + + +Conclusion +---------- + +There are several disadvantages of using Pyrex: + +1. The syntax for Pyrex can get a bit bulky, and it can be confusing at + first to understand what kind of objects you are getting and how to + interface them with C-like constructs. + +2. Inappropriate Pyrex syntax or incorrect calls to C-code or type- + mismatches can result in failures such as + + 1. Pyrex failing to generate the extension module source code, + + 2. Compiler failure while generating the extension module binary due to + incorrect C syntax, + + 3. Python failure when trying to use the module. + + +3. It is easy to lose a clean separation between Python and C which makes + re-using your C-code for other non-Python-related projects more + difficult. + +4. Multi-dimensional arrays are "bulky" to index (appropriate macros + may be able to fix this). + +5. The C-code generated by Prex is hard to read and modify (and typically + compiles with annoying but harmless warnings). + +Writing a good Pyrex extension module still takes a bit of effort +because not only does it require (a little) familiarity with C, but +also with Pyrex's brand of Python-mixed-with C. One big advantage of +Pyrex-generated extension modules is that they are easy to distribute +using distutils. In summary, Pyrex is a very capable tool for either +gluing C-code or generating an extension module quickly and should not +be over-looked. It is especially useful for people that can't or won't +write C-code or Fortran code. But, if you are already able to write +simple subroutines in C or Fortran, then I would use one of the other +approaches such as f2py (for Fortran), ctypes (for C shared- +libraries), or weave (for inline C-code). + +.. index:: + single: pyrex + + + + +ctypes +====== + +Ctypes is a python extension module (downloaded separately for Python +<2.5 and included with Python 2.5) that allows you to call an +arbitrary function in a shared library directly from Python. This +approach allows you to interface with C-code directly from Python. +This opens up an enormous number of libraries for use from Python. The +drawback, however, is that coding mistakes can lead to ugly program +crashes very easily (just as can happen in C) because there is little +type or bounds checking done on the parameters. This is especially +true when array data is passed in as a pointer to a raw memory +location. The responsibility is then on you that the subroutine will +not access memory outside the actual array area. But, if you don't +mind living a little dangerously ctypes can be an effective tool for +quickly taking advantage of a large shared library (or writing +extended functionality in your own shared library). + +.. index:: + single: ctypes + +Because the ctypes approach exposes a raw interface to the compiled +code it is not always tolerant of user mistakes. Robust use of the +ctypes module typically involves an additional layer of Python code in +order to check the data types and array bounds of objects passed to +the underlying subroutine. This additional layer of checking (not to +mention the conversion from ctypes objects to C-data-types that ctypes +itself performs), will make the interface slower than a hand-written +extension-module interface. However, this overhead should be neglible +if the C-routine being called is doing any significant amount of work. +If you are a great Python programmer with weak C-skills, ctypes is an +easy way to write a useful interface to a (shared) library of compiled +code. + +To use c-types you must + +1. Have a shared library. + +2. Load the shared library. + +3. Convert the python objects to ctypes-understood arguments. + +4. Call the function from the library with the ctypes arguments. + + +Having a shared library +----------------------- + +There are several requirements for a shared library that can be used +with c-types that are platform specific. This guide assumes you have +some familiarity with making a shared library on your system (or +simply have a shared library available to you). Items to remember are: + +- A shared library must be compiled in a special way ( *e.g.* using + the -shared flag with gcc). + +- On some platforms (*e.g.* Windows) , a shared library requires a + .def file that specifies the functions to be exported. For example a + mylib.def file might contain. + + :: + + LIBRARY mylib.dll + EXPORTS + cool_function1 + cool_function2 + + Alternatively, you may be able to use the storage-class specifier + __declspec(dllexport) in the C-definition of the function to avoid the + need for this .def file. + +There is no standard way in Python distutils to create a standard +shared library (an extension module is a "special" shared library +Python understands) in a cross-platform manner. Thus, a big +disadvantage of ctypes at the time of writing this book is that it is +difficult to distribute in a cross-platform manner a Python extension +that uses c-types and includes your own code which should be compiled +as a shared library on the users system. + + +Loading the shared library +-------------------------- + +A simple, but robust way to load the shared library is to get the +absolute path name and load it using the cdll object of ctypes.: + +.. code-block:: python + + lib = ctypes.cdll[] + +However, on Windows accessing an attribute of the cdll method will +load the first DLL by that name found in the current directory or on +the PATH. Loading the absolute path name requires a little finesse for +cross-platform work since the extension of shared libraries varies. +There is a ``ctypes.util.find_library`` utility available that can +simplify the process of finding the library to load but it is not +foolproof. Complicating matters, different platforms have different +default extensions used by shared libraries (e.g. .dll -- Windows, .so +-- Linux, .dylib -- Mac OS X). This must also be taken into account if +you are using c-types to wrap code that needs to work on several +platforms. + +NumPy provides a convenience function called +:func:`ctypeslib.load_library` (name, path). This function takes the name +of the shared library (including any prefix like 'lib' but excluding +the extension) and a path where the shared library can be located. It +returns a ctypes library object or raises an OSError if the library +cannot be found or raises an ImportError if the ctypes module is not +available. (Windows users: the ctypes library object loaded using +:func:`load_library` is always loaded assuming cdecl calling convention. +See the ctypes documentation under ctypes.windll and/or ctypes.oledll +for ways to load libraries under other calling conventions). + +The functions in the shared library are available as attributes of the +ctypes library object (returned from :func:`ctypeslib.load_library`) or +as items using ``lib['func_name']`` syntax. The latter method for +retrieving a function name is particularly useful if the function name +contains characters that are not allowable in Python variable names. + + +Converting arguments +-------------------- + +Python ints/longs, strings, and unicode objects are automatically +converted as needed to equivalent c-types arguments The None object is +also converted automatically to a NULL pointer. All other Python +objects must be converted to ctypes-specific types. There are two ways +around this restriction that allow c-types to integrate with other +objects. + +1. Don't set the argtypes attribute of the function object and define an + :obj:`_as_parameter_` method for the object you want to pass in. The + :obj:`_as_parameter_` method must return a Python int which will be passed + directly to the function. + +2. Set the argtypes attribute to a list whose entries contain objects + with a classmethod named from_param that knows how to convert your + object to an object that ctypes can understand (an int/long, string, + unicode, or object with the :obj:`_as_parameter_` attribute). + +NumPy uses both methods with a preference for the second method +because it can be safer. The ctypes attribute of the ndarray returns +an object that has an _as_parameter\_ attribute which returns an +integer representing the address of the ndarray to which it is +associated. As a result, one can pass this ctypes attribute object +directly to a function expecting a pointer to the data in your +ndarray. The caller must be sure that the ndarray object is of the +correct type, shape, and has the correct flags set or risk nasty +crashes if the data-pointer to inappropriate arrays are passsed in. + +To implement the second method, NumPy provides the class-factory +function :func:`ndpointer` in the :mod:`ctypeslib` module. This +class-factory function produces an appropriate class that can be +placed in an argtypes attribute entry of a ctypes function. The class +will contain a from_param method which ctypes will use to convert any +ndarray passed in to the function to a ctypes-recognized object. In +the process, the conversion will perform checking on any properties of +the ndarray that were specified by the user in the call to :func:`ndpointer`. +Aspects of the ndarray that can be checked include the data-type, the +number-of-dimensions, the shape, and/or the state of the flags on any +array passed. The return value of the from_param method is the ctypes +attribute of the array which (because it contains the _as_parameter\_ +attribute pointing to the array data area) can be used by ctypes +directly. + +The ctypes attribute of an ndarray is also endowed with additional +attributes that may be convenient when passing additional information +about the array into a ctypes function. The attributes **data**, +**shape**, and **strides** can provide c-types compatible types +corresponding to the data-area, the shape, and the strides of the +array. The data attribute reutrns a ``c_void_p`` representing a +pointer to the data area. The shape and strides attributes each return +an array of ctypes integers (or None representing a NULL pointer, if a +0-d array). The base ctype of the array is a ctype integer of the same +size as a pointer on the platform. There are also methods +data_as({ctype}), shape_as(), and strides_as(). These return the data as a ctype object of your choice and +the shape/strides arrays using an underlying base type of your choice. +For convenience, the **ctypeslib** module also contains **c_intp** as +a ctypes integer data-type whose size is the same as the size of +``c_void_p`` on the platform (it's value is None if ctypes is not +installed). + + +Calling the function +-------------------- + +The function is accessed as an attribute of or an item from the loaded +shared-library. Thus, if "./mylib.so" has a function named +"cool_function1" , I could access this function either as: + +.. code-block:: python + + lib = numpy.ctypeslib.load_library('mylib','.') + func1 = lib.cool_function1 # or equivalently + func1 = lib['cool_function1'] + +In ctypes, the return-value of a function is set to be 'int' by +default. This behavior can be changed by setting the restype attribute +of the function. Use None for the restype if the function has no +return value ('void'): + +.. code-block:: python + + func1.restype = None + +As previously discussed, you can also set the argtypes attribute of +the function in order to have ctypes check the types of the input +arguments when the function is called. Use the :func:`ndpointer` factory +function to generate a ready-made class for data-type, shape, and +flags checking on your new function. The :func:`ndpointer` function has the +signature + +.. function:: ndpointer(dtype=None, ndim=None, shape=None, flags=None) + + Keyword arguments with the value ``None`` are not checked. + Specifying a keyword enforces checking of that aspect of the + ndarray on conversion to a ctypes-compatible object. The dtype + keyword can be any object understood as a data-type object. The + ndim keyword should be an integer, and the shape keyword should be + an integer or a sequence of integers. The flags keyword specifies + the minimal flags that are required on any array passed in. This + can be specified as a string of comma separated requirements, an + integer indicating the requirement bits OR'd together, or a flags + object returned from the flags attribute of an array with the + necessary requirements. + +Using an ndpointer class in the argtypes method can make it +significantly safer to call a C-function using ctypes and the data- +area of an ndarray. You may still want to wrap the function in an +additional Python wrapper to make it user-friendly (hiding some +obvious arguments and making some arguments output arguments). In this +process, the **requires** function in NumPy may be useful to return the right kind of array from +a given input. + + +Complete example +---------------- + +In this example, I will show how the addition function and the filter +function implemented previously using the other approaches can be +implemented using ctypes. First, the C-code which implements the +algorithms contains the functions zadd, dadd, sadd, cadd, and +dfilter2d. The zadd function is: + +.. code-block:: c + + /* Add arrays of contiguous data */ + typedef struct {double real; double imag;} cdouble; + typedef struct {float real; float imag;} cfloat; + void zadd(cdouble *a, cdouble *b, cdouble *c, long n) + { + while (n--) { + c->real = a->real + b->real; + c->imag = a->imag + b->imag; + a++; b++; c++; + } + } + +with similar code for cadd, dadd, and sadd that handles complex float, +double, and float data-types, respectively: + +.. code-block:: c + + void cadd(cfloat *a, cfloat *b, cfloat *c, long n) + { + while (n--) { + c->real = a->real + b->real; + c->imag = a->imag + b->imag; + a++; b++; c++; + } + } + void dadd(double *a, double *b, double *c, long n) + { + while (n--) { + *c++ = *a++ + *b++; + } + } + void sadd(float *a, float *b, float *c, long n) + { + while (n--) { + *c++ = *a++ + *b++; + } + } + +The code.c file also contains the function dfilter2d: + +.. code-block:: c + + /* Assumes b is contiguous and + a has strides that are multiples of sizeof(double) + */ + void + dfilter2d(double *a, double *b, int *astrides, int *dims) + { + int i, j, M, N, S0, S1; + int r, c, rm1, rp1, cp1, cm1; + + M = dims[0]; N = dims[1]; + S0 = astrides[0]/sizeof(double); + S1=astrides[1]/sizeof(double); + for (i=1; idimensions[0]; + int dims[1]; + dims[0] = n; + PyArrayObject* ret; + ret = (PyArrayObject*) PyArray_FromDims(1, dims, NPY_DOUBLE); + int i; + char *aj=a->data; + char *bj=b->data; + double *retj = (double *)ret->data; + for (i=0; i < n; i++) { + *retj++ = *((double *)aj) + *((double *)bj); + aj += a->strides[0]; + bj += b->strides[0]; + } + return (PyObject *)ret; + } + """ + import Instant, numpy + ext = Instant.Instant() + ext.create_extension(code=s, headers=["numpy/arrayobject.h"], + include_dirs=[numpy.get_include()], + init_code='import_array();', module="test2b_ext") + import test2b_ext + a = numpy.arange(1000) + b = numpy.arange(1000) + d = test2b_ext.add(a,b) + +Except perhaps for the dependence on SWIG, Instant is a +straightforward utility for writing extension modules. + + +PyInline +-------- + +This is a much older module that allows automatic building of +extension modules so that C-code can be included with Python code. +It's latest release (version 0.03) was in 2001, and it appears that it +is not being updated. + + +PyFort +------ + +PyFort is a nice tool for wrapping Fortran and Fortran-like C-code +into Python with support for Numeric arrays. It was written by Paul +Dubois, a distinguished computer scientist and the very first +maintainer of Numeric (now retired). It is worth mentioning in the +hopes that somebody will update PyFort to work with NumPy arrays as +well which now support either Fortran or C-style contiguous arrays. Added: numpy-docs/trunk/source/user/c-info.rst =================================================================== --- numpy-docs/trunk/source/user/c-info.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/c-info.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,9 @@ +################# +Using Numpy C-API +################# + +.. toctree:: + + c-info.how-to-extend + c-info.python-as-glue + c-info.beyond-basics Added: numpy-docs/trunk/source/user/howtofind.rst =================================================================== --- numpy-docs/trunk/source/user/howtofind.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/howtofind.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,9 @@ +************************* +How to find documentation +************************* + +.. seealso:: :ref:`Numpy-specific help functions ` + +.. note:: XXX: this part is not yet written. + +.. automodule:: numpy.doc.howtofind Added: numpy-docs/trunk/source/user/index.rst =================================================================== --- numpy-docs/trunk/source/user/index.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/index.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,27 @@ +.. _user: + +################ +Numpy User Guide +################ + +This guide explains how to make use of different features +of Numpy. For a detailed documentation about different functions +and classes, see :ref:`reference`. + +.. warning:: + + This "User Guide" is still very much work in progress; the material + is not organized, and many aspects of Numpy are not covered. + + More documentation for Numpy can be found on the + `scipy.org `__ website. + +.. toctree:: + :maxdepth: 2 + + howtofind + basics + performance + misc + c-info + Added: numpy-docs/trunk/source/user/misc.rst =================================================================== --- numpy-docs/trunk/source/user/misc.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/misc.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,9 @@ +************* +Miscellaneous +************* + +.. note:: XXX: This section is not yet written. + +.. automodule:: numpy.doc.misc + +.. automodule:: numpy.doc.methods_vs_functions Added: numpy-docs/trunk/source/user/performance.rst =================================================================== --- numpy-docs/trunk/source/user/performance.rst 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/source/user/performance.rst 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,7 @@ +*********** +Performance +*********** + +.. note:: XXX: This section is not yet written. + +.. automodule:: numpy.doc.performance Added: numpy-docs/trunk/summarize.py =================================================================== --- numpy-docs/trunk/summarize.py 2008-10-26 17:50:36 UTC (rev 5958) +++ numpy-docs/trunk/summarize.py 2008-10-26 17:57:55 UTC (rev 5959) @@ -0,0 +1,167 @@ +#!/usr/bin/env python +""" +summarize.py + +Show a summary about which Numpy functions are documented and which are not. + +""" + +import os, glob, re, sys, inspect, optparse +sys.path.append(os.path.join(os.path.dirname(__file__), 'ext')) +from ext.phantom_import import import_phantom_module + +from ext.autosummary_generate import get_documented + +CUR_DIR = os.path.dirname(__file__) +SOURCE_DIR = os.path.join(CUR_DIR, 'source', 'reference') + +SKIP_LIST = """ +# --- aliases: +alltrue sometrue bitwise_not cumproduct +row_stack column_stack product rank + +# -- skipped: +core lib f2py dual doc emath ma rec char distutils oldnumeric numarray +testing version matlib + +add_docstring add_newdoc add_newdocs fastCopyAndTranspose pkgload +conjugate disp + +int0 object0 unicode0 uint0 string_ string0 void0 + +flagsobj + +setup setupscons PackageLoader + +lib.scimath.arccos lib.scimath.arcsin lib.scimath.arccosh lib.scimath.arcsinh +lib.scimath.arctanh lib.scimath.log lib.scimath.log2 lib.scimath.log10 +lib.scimath.logn lib.scimath.power lib.scimath.sqrt + +# --- numpy.random: +random random.info random.mtrand random.ranf random.sample random.random + +# --- numpy.fft: +fft fft.Tester fft.bench fft.fftpack fft.fftpack_lite fft.helper +fft.refft fft.refft2 fft.refftn fft.irefft fft.irefft2 fft.irefftn +fft.info fft.test + +# --- numpy.linalg: +linalg linalg.Tester +linalg.bench linalg.info linalg.lapack_lite linalg.linalg linalg.test + +# --- numpy.ctypeslib: +ctypeslib ctypeslib.test + +""".split() + +def main(): + p = optparse.OptionParser(__doc__) + options, args = p.parse_args() + + if len(args) != 0: + p.error('Wrong number of arguments') + + # prepare + fn = os.path.join(CUR_DIR, 'dump.xml') + if os.path.isfile(fn): + import_phantom_module(fn) + + # check + documented, undocumented = check_numpy() + + # report + in_sections = {} + for name, locations in documented.iteritems(): + for (filename, section, keyword, toctree) in locations: + in_sections.setdefault((filename, section, keyword), []).append(name) + + print "Documented" + print "==========\n" + + last_filename = None + for (filename, section, keyword), names in sorted(in_sections.items()): + if filename != last_filename: + print "--- %s\n" % filename + last_filename = filename + print " ** ", section + print format_in_columns(sorted(names)) + print "\n" + + print "" + print "Undocumented" + print "============\n" + print format_in_columns(sorted(undocumented.keys())) + +def check_numpy(): + documented = get_documented(glob.glob(SOURCE_DIR + '/*.rst')) + undocumented = {} + + import numpy, numpy.fft, numpy.linalg, numpy.random + for mod in [numpy, numpy.fft, numpy.linalg, numpy.random, + numpy.ctypeslib, numpy.emath, numpy.ma]: + undocumented.update(get_undocumented(documented, mod, skip=SKIP_LIST)) + + for d in (documented, undocumented): + for k in d.keys(): + if k.startswith('numpy.'): + d[k[6:]] = d[k] + del d[k] + + return documented, undocumented + +def get_undocumented(documented, module, module_name=None, skip=[]): + """ + Find out which items in Numpy are not documented. + + Returns + ------- + undocumented : dict of bool + Dictionary containing True for each documented item name + and False for each undocumented one. + + """ + undocumented = {} + + if module_name is None: + module_name = module.__name__ + + for name in dir(module): + obj = getattr(module, name) + if name.startswith('_'): continue + + full_name = '.'.join([module_name, name]) + + if full_name in skip: continue + if full_name.startswith('numpy.') and full_name[6:] in skip: continue + if not (inspect.ismodule(obj) or callable(obj) or inspect.isclass(obj)): + continue + + if full_name not in documented: + undocumented[full_name] = True + + return undocumented + +def format_in_columns(lst): + """ + Format a list containing strings to a string containing the items + in columns. + """ + lst = map(str, lst) + col_len = max(map(len, lst)) + 2 + ncols = 80//col_len + if ncols == 0: + ncols = 1 + + if len(lst) % ncols == 0: + nrows = len(lst)//ncols + else: + nrows = 1 + len(lst)//ncols + + fmt = ' %%-%ds ' % (col_len-2) + + lines = [] + for n in range(nrows): + lines.append("".join([fmt % x for x in lst[n::nrows]])) + return "\n".join(lines) + +if __name__ == "__main__": main() Property changes on: numpy-docs/trunk/summarize.py ___________________________________________________________________ Name: svn:executable + From numpy-svn at scipy.org Sun Oct 26 14:06:57 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 26 Oct 2008 13:06:57 -0500 (CDT) Subject: [Numpy-svn] r5960 - numpy-docs/trunk Message-ID: <20081026180657.647A439C05F@scipy.org> Author: ptvirtan Date: 2008-10-26 13:06:49 -0500 (Sun, 26 Oct 2008) New Revision: 5960 Modified: numpy-docs/trunk/ Log: Set svn:ignore appropriately Property changes on: numpy-docs/trunk ___________________________________________________________________ Name: svn:ignore + source/reference/generated build *.pyc *~ From numpy-svn at scipy.org Sun Oct 26 14:17:00 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 26 Oct 2008 13:17:00 -0500 (CDT) Subject: [Numpy-svn] r5961 - in numpy-docs/trunk: . source/reference Message-ID: <20081026181700.B445039C05F@scipy.org> Author: ptvirtan Date: 2008-10-26 13:16:50 -0500 (Sun, 26 Oct 2008) New Revision: 5961 Modified: numpy-docs/trunk/ numpy-docs/trunk/source/reference/ Log: Set svn:ignore properly Property changes on: numpy-docs/trunk ___________________________________________________________________ Name: svn:ignore - source/reference/generated build *.pyc *~ + build *.pyc *~ Property changes on: numpy-docs/trunk/source/reference ___________________________________________________________________ Name: svn:ignore + generated From numpy-svn at scipy.org Mon Oct 27 19:41:06 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 27 Oct 2008 18:41:06 -0500 (CDT) Subject: [Numpy-svn] r5962 - in trunk/numpy: core core/code_generators lib random/mtrand Message-ID: <20081027234106.9B68539C089@scipy.org> Author: ptvirtan Date: 2008-10-27 18:40:52 -0500 (Mon, 27 Oct 2008) New Revision: 5962 Modified: trunk/numpy/core/code_generators/docstrings.py trunk/numpy/core/defmatrix.py trunk/numpy/core/fromnumeric.py trunk/numpy/core/numeric.py trunk/numpy/lib/function_base.py trunk/numpy/lib/polynomial.py trunk/numpy/lib/twodim_base.py trunk/numpy/random/mtrand/mtrand.pyx Log: Import documentation from doc wiki (part 1) Modified: trunk/numpy/core/code_generators/docstrings.py =================================================================== --- trunk/numpy/core/code_generators/docstrings.py 2008-10-26 18:16:50 UTC (rev 5961) +++ trunk/numpy/core/code_generators/docstrings.py 2008-10-27 23:40:52 UTC (rev 5962) @@ -11,22 +11,20 @@ add_newdoc('numpy.core.umath', 'absolute', """ - Calculate the absolute value elementwise. + Calculate the absolute value element-wise. Parameters ---------- x : array_like - An array-like sequence of values or a scalar. + Input array. Returns ------- - res : {ndarray, scalar} + res : ndarray An ndarray containing the absolute value of each element in `x`. For complex input, ``a + ib``, the absolute value is :math:`\\sqrt{ a^2 + b^2 }`. - Returns a scalar for scalar input. - Examples -------- >>> x = np.array([-1.2, 1.2]) @@ -1126,6 +1124,13 @@ >>> np.greater([4,2],[2,2]) array([ True, False], dtype=bool) + If the inputs are ndarrays, then np.greater is equivalent to '>'. + + >>> a = np.array([4,2]) + >>> b = np.array([2,2]) + >>> a > b + array([ True, False], dtype=bool) + """) add_newdoc('numpy.core.umath', 'greater_equal', @@ -2104,14 +2109,15 @@ Returns ------- y : ndarray - The square-root of each element in `x`. If any element in `x` + An array of the same shape as `x`, containing the square-root of + each element in `x`. If any element in `x` is complex, a complex array is returned. If all of the elements - of `x` are real, negative elements will return numpy.nan elements. + of `x` are real, negative elements return numpy.nan elements. See Also -------- numpy.lib.scimath.sqrt - A version which will return complex numbers when given negative reals. + A version which returns complex numbers when given negative reals. Notes ----- Modified: trunk/numpy/core/defmatrix.py =================================================================== --- trunk/numpy/core/defmatrix.py 2008-10-26 18:16:50 UTC (rev 5961) +++ trunk/numpy/core/defmatrix.py 2008-10-27 23:40:52 UTC (rev 5962) @@ -590,6 +590,11 @@ Input data. Variables names in the current scope may be referenced, even if `obj` is a string. + Returns + ------- + out : matrix + Returns a matrix object, which is a specialized 2-D array. + See Also -------- matrix Modified: trunk/numpy/core/fromnumeric.py =================================================================== --- trunk/numpy/core/fromnumeric.py 2008-10-26 18:16:50 UTC (rev 5961) +++ trunk/numpy/core/fromnumeric.py 2008-10-27 23:40:52 UTC (rev 5962) @@ -294,7 +294,7 @@ Returns ------- a_swapped : ndarray - If `a` is an ndarray, then a view on `a` is returned, otherwise + If `a` is an ndarray, then a view of `a` is returned; otherwise a new array is created. Examples @@ -1176,11 +1176,9 @@ """ Return the product of array elements over a given axis. - Refer to `numpy.prod` for full documentation. - See Also -------- - prod : equivalent function + prod : equivalent function; see for details. """ try: @@ -1390,11 +1388,10 @@ """ Return the cumulative product over the given axis. - See `cumprod` for full documentation. See Also -------- - cumprod + cumprod : equivalent function; see for details. """ try: @@ -1449,7 +1446,7 @@ def amax(a, axis=None, out=None): """ - Return the maximum along a given axis. + Return the maximum along an axis. Parameters ---------- @@ -1463,19 +1460,19 @@ Returns ------- - amax : {ndarray, scalar} + amax : ndarray A new array or a scalar with the result, or a reference to `out` if it was specified. Examples -------- - >>> x = np.arange(4).reshape((2,2)) - >>> x + >>> a = np.arange(4).reshape((2,2)) + >>> a array([[0, 1], [2, 3]]) - >>> np.amax(x,0) + >>> np.amax(a, axis=0) array([2, 3]) - >>> np.amax(x,1) + >>> np.amax(a, axis=1) array([1, 3]) """ @@ -1488,7 +1485,7 @@ def amin(a, axis=None, out=None): """ - Return the minimum along a given axis. + Return the minimum along an axis. Parameters ---------- @@ -1502,19 +1499,21 @@ Returns ------- - amin : {ndarray, scalar} + amin : ndarray A new array or a scalar with the result, or a reference to `out` if it was specified. Examples -------- - >>> x = np.arange(4).reshape((2,2)) - >>> x + >>> a = np.arange(4).reshape((2,2)) + >>> a array([[0, 1], [2, 3]]) - >>> np.amin(x,0) + >>> np.amin(a) # Minimum of the flattened array + 0 + >>> np.amin(a, axis=0) # Minima along the first axis array([0, 1]) - >>> np.amin(x,1) + >>> np.amin(a, axis=1) # Minima along the second axis array([0, 2]) """ @@ -1640,7 +1639,7 @@ Parameters ---------- - a : array-like + a : array_like Input array. axis : int, optional Axis along which the cumulative product is computed. By default the @@ -1658,7 +1657,7 @@ Returns ------- - cumprod : ndarray. + cumprod : ndarray A new array holding the result is returned unless `out` is specified, in which case a reference to out is returned. @@ -1925,21 +1924,21 @@ a : array_like Array containing numbers whose mean is desired. If `a` is not an array, a conversion is attempted. - axis : {None, int}, optional + axis : int, optional Axis along which the means are computed. The default is to compute the mean of the flattened array. - dtype : {None, dtype}, optional - Type to use in computing the mean. For integer inputs the default - is float64; for floating point inputs it is the same as the input + dtype : dtype, optional + Type to use in computing the mean. For integer inputs, the default + is float64; for floating point, inputs it is the same as the input dtype. - out : {None, ndarray}, optional + out : ndarray, optional Alternative output array in which to place the result. It must have the same shape as the expected output but the type will be cast if necessary. Returns ------- - mean : {ndarray, scalar}, see dtype parameter above + mean : ndarray, see dtype parameter above If `out=None`, returns a new array containing the mean values, otherwise a reference to the output array is returned. @@ -2050,27 +2049,27 @@ Parameters ---------- a : array_like - Array containing numbers whose variance is desired. If a is not an + Array containing numbers whose variance is desired. If `a` is not an array, a conversion is attempted. axis : int, optional Axis along which the variance is computed. The default is to compute the variance of the flattened array. dtype : dtype, optional Type to use in computing the variance. For arrays of integer type - the default is float32, for arrays of float types it is the same as + the default is float32; for arrays of float types it is the same as the array type. out : ndarray, optional Alternative output array in which to place the result. It must have - the same shape as the expected output but the type will be cast if + the same shape as the expected output but the type is cast if necessary. ddof : positive int,optional - Means Delta Degrees of Freedom. The divisor used in calculation is + "Delta Degrees of Freedom": the divisor used in calculation is N - ddof. Returns ------- - variance : {ndarray, scalar}, see dtype parameter above - If out=None, returns a new array containing the variance, otherwise + variance : ndarray, see dtype parameter above + If out=None, returns a new array containing the variance; otherwise a reference to the output array is returned. See Also @@ -2081,7 +2080,7 @@ Notes ----- The variance is the average of the squared deviations from the mean, - i.e. var = mean(abs(x - x.mean())**2). The computed variance is biased, + i.e., var = mean(abs(x - x.mean())**2). The computed variance is biased, i.e., the mean is computed by dividing by the number of elements, N, rather than by N-1. Note that for complex numbers the absolute value is taken before squaring, so that the result is always real and nonnegative. Modified: trunk/numpy/core/numeric.py =================================================================== --- trunk/numpy/core/numeric.py 2008-10-26 18:16:50 UTC (rev 5961) +++ trunk/numpy/core/numeric.py 2008-10-27 23:40:52 UTC (rev 5962) @@ -687,20 +687,18 @@ except ImportError: def alterdot(): """ - Change `dot`, `vdot`, and `innerproduct` to use accelerated BLAS - functions. + Change `dot`, `vdot`, and `innerproduct` to use accelerated BLAS functions. - When numpy is built with an accelerated BLAS like ATLAS, the above - functions will be replaced to make use of the faster implementations. - The faster implementations only affect float32, float64, complex64, and - complex128 arrays. Furthermore, only matrix-matrix, matrix-vector, and - vector-vector products are accelerated. Products of arrays with larger - dimensionalities will not be accelerated since the BLAS API only - includes these. + Typically, as a user of Numpy, you do not explicitly call this function. If + Numpy is built with an accelerated BLAS, this function is automatically + called when Numpy is imported. - Typically, the user will never have to call this function. If numpy was - built with an accelerated BLAS, this function will be called when numpy - is imported. + When Numpy is built with an accelerated BLAS like ATLAS, these functions + are replaced to make use of the faster implementations. The faster + implementations only affect float32, float64, complex64, and complex128 + arrays. Furthermore, the BLAS API only includes matrix-matrix, + matrix-vector, and vector-vector products. Products of arrays with larger + dimensionalities use the built in functions and are not accelerated. See Also -------- Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2008-10-26 18:16:50 UTC (rev 5961) +++ trunk/numpy/lib/function_base.py 2008-10-27 23:40:52 UTC (rev 5962) @@ -1128,6 +1128,17 @@ >>> np.interp(3.14, xp, fp, right=UNDEF) -99.0 + Plot an interpolant to the sine function: + + >>> x = np.linspace(0, 2*np.pi, 10) + >>> y = np.sin(x) + >>> xvals = np.linspace(0, 2*np.pi, 50) + >>> yinterp = np.interp(xvals, x, y) + >>> import matplotlib.pyplot as plt + >>> plt.plot(x, y, 'o') + >>> plt.plot(xvals, yinterp, '-x') + >>> plt.show() + """ if isinstance(x, (float, int, number)): return compiled_interp([x], xp, fp, left, right).item() Modified: trunk/numpy/lib/polynomial.py =================================================================== --- trunk/numpy/lib/polynomial.py 2008-10-26 18:16:50 UTC (rev 5961) +++ trunk/numpy/lib/polynomial.py 2008-10-27 23:40:52 UTC (rev 5962) @@ -277,7 +277,7 @@ def polyder(p, m=1): """ - Return the derivative of order m of a polynomial. + Return the derivative of the specified order of a polynomial. Parameters ---------- @@ -295,6 +295,7 @@ See Also -------- polyint : Anti-derivative of a polynomial. + poly1d : Class for one-dimensional polynomials. Examples -------- Modified: trunk/numpy/lib/twodim_base.py =================================================================== --- trunk/numpy/lib/twodim_base.py 2008-10-26 18:16:50 UTC (rev 5961) +++ trunk/numpy/lib/twodim_base.py 2008-10-27 23:40:52 UTC (rev 5962) @@ -165,14 +165,14 @@ Number of columns in the output. If None, defaults to `N`. k : int, optional Index of the diagonal: 0 refers to the main diagonal, a positive value - refers to an upper diagonal and a negative value to a lower diagonal. + refers to an upper diagonal, and a negative value to a lower diagonal. dtype : dtype, optional Data-type of the returned array. Returns ------- I : ndarray (N,M) - An array where all elements are equal to zero, except for the k'th + An array where all elements are equal to zero, except for the `k`-th diagonal, whose values are equal to one. See Also Modified: trunk/numpy/random/mtrand/mtrand.pyx =================================================================== --- trunk/numpy/random/mtrand/mtrand.pyx 2008-10-26 18:16:50 UTC (rev 5961) +++ trunk/numpy/random/mtrand/mtrand.pyx 2008-10-27 23:40:52 UTC (rev 5962) @@ -1902,7 +1902,7 @@ """ lognormal(mean=0.0, sigma=1.0, size=None) - Log-normal distribution. + 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 @@ -1938,7 +1938,7 @@ 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 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 @@ -1947,7 +1947,7 @@ 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 lognormal distribution has widespread + most mechanical systems, the log-normal distribution has widespread application. It is also commonly used to model oil field sizes, species abundance, and @@ -1986,7 +1986,7 @@ >>> plt.show() Demonstrate that taking the products of random samples from a uniform - distribution can be fit well by a log-normal pdf. + 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. From numpy-svn at scipy.org Mon Oct 27 20:14:23 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 27 Oct 2008 19:14:23 -0500 (CDT) Subject: [Numpy-svn] r5963 - in trunk/numpy: . core core/code_generators doc fft lib linalg ma random/mtrand Message-ID: <20081028001423.F20FCC7C009@scipy.org> Author: ptvirtan Date: 2008-10-27 19:13:44 -0500 (Mon, 27 Oct 2008) New Revision: 5963 Modified: trunk/numpy/__init__.py trunk/numpy/add_newdocs.py trunk/numpy/core/arrayprint.py trunk/numpy/core/code_generators/docstrings.py trunk/numpy/core/defchararray.py trunk/numpy/core/fromnumeric.py trunk/numpy/core/numeric.py trunk/numpy/core/numerictypes.py trunk/numpy/doc/basics.py trunk/numpy/doc/creation.py trunk/numpy/doc/glossary.py trunk/numpy/doc/misc.py trunk/numpy/doc/subclassing.py trunk/numpy/fft/fftpack.py trunk/numpy/fft/helper.py trunk/numpy/lib/__init__.py trunk/numpy/lib/_datasource.py trunk/numpy/lib/arraysetops.py trunk/numpy/lib/financial.py trunk/numpy/lib/function_base.py trunk/numpy/lib/getlimits.py trunk/numpy/lib/index_tricks.py trunk/numpy/lib/io.py trunk/numpy/lib/polynomial.py trunk/numpy/lib/shape_base.py trunk/numpy/lib/twodim_base.py trunk/numpy/lib/type_check.py trunk/numpy/lib/ufunclike.py trunk/numpy/lib/utils.py trunk/numpy/linalg/linalg.py trunk/numpy/ma/__init__.py trunk/numpy/ma/core.py trunk/numpy/ma/extras.py trunk/numpy/matlib.py trunk/numpy/random/mtrand/mtrand.pyx Log: Import documentation from doc wiki (part 2, work-in-progress docstrings, but they are still an improvement) Modified: trunk/numpy/__init__.py =================================================================== --- trunk/numpy/__init__.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/__init__.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -30,13 +30,18 @@ >>> help(np.sort) -For some objects, ``np.info(obj)`` may provide additional help. +For some objects, ``np.info(obj)`` may provide additional help. This is +particularly true if you see the line "Help on ufunc object:" at the top +of the help() page. Ufuncs are implemented in C, not Python, for speed. +The native Python help() does not know how to view their help, but our +np.info() function does. -To search for objects of which the documentation contains keywords, do:: +To search for documents containing a keyword, do:: >>> np.lookfor('keyword') -Topical documentation is available under the ``doc`` sub-module:: +General-purpose documents like a glossary and help on the basic concepts +of numpy are available under the ``doc`` sub-module:: >>> from numpy import doc >>> help(doc) @@ -87,10 +92,10 @@ Copies vs. in-place operation ----------------------------- -Most of the methods in `numpy` return a copy of the array argument (e.g., -`sort`). In-place versions of these methods are often available as -array methods, i.e. ``x = np.array([1,2,3]); x.sort()``. Exceptions to -this rule are documented. +Most of the functions in `numpy` return a copy of the array argument +(e.g., `sort`). In-place versions of these functions are often +available as array methods, i.e. ``x = np.array([1,2,3]); x.sort()``. +Exceptions to this rule are documented. """ Modified: trunk/numpy/add_newdocs.py =================================================================== --- trunk/numpy/add_newdocs.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/add_newdocs.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -65,12 +65,26 @@ add_newdoc('numpy.core', 'dtype', """ - Create a data type. + dtype(obj, align=False, copy=False) + Create a data type object. + A numpy array is homogeneous, and contains elements described by a - dtype. A dtype can be constructed from different combinations of - fundamental numeric types, as illustrated below. + dtype object. A dtype object can be constructed from different + combinations of fundamental numeric types. + Parameters + ---------- + obj + Object to be converted to a data type object. + align : bool, optional + Add padding to the fields to match what a C compiler would output + for a similar C-struct. Can be ``True`` only if `obj` is a dictionary + or a comma-separated string. + copy : bool, optional + Make a new copy of the data-type object. If ``False``, the result + may just be a reference to a built-in data-type object. + Examples -------- Using array-scalar type: @@ -228,7 +242,7 @@ Parameters ---------- - object : array-like + object : array_like An array, any object exposing the array interface, an object whose __array__ method returns an array, or any (nested) sequence. @@ -752,15 +766,16 @@ Values are generated within the half-open interval ``[start, stop)`` (in other words, the interval including `start` but excluding `stop`). - For integer arguments, the function is equivalent to ``range`` - (but returns an array). + For integer arguments the function is equivalent to the Python built-in + `range `_ function, + but returns a ndarray rather than a list. Parameters ---------- start : number, optional Start of interval. The interval includes this value. The default start value is 0. - end : number + stop : number End of interval. The interval does not include this value. step : number, optional Spacing between values. For any output `out`, this is the distance @@ -782,7 +797,6 @@ See Also -------- - range : The Python equivalent for integers linspace : Evenly spaced numbers with careful handling of endpoints. ogrid: Arrays of evenly spaced numbers in N-dimensions mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions @@ -913,7 +927,7 @@ See Also -------- - nonzero + nonzero, choose Notes ----- @@ -964,18 +978,19 @@ keys : (k,N) array or tuple containing k (N,)-shaped sequences The `k` different "columns" to be sorted. The last column is the primary sort column. - axis : integer, optional + axis : int, optional Axis to be indirectly sorted. By default, sort over the last axis. Returns ------- - indices : (N,) integer array + indices : (N,) ndarray of ints Array of indices that sort the keys along the specified axis. See Also -------- argsort : Indirect sort. - sort : In-place sort. + ndarray.sort : In-place sort. + sort : Return a sorted copy of an array. Examples -------- @@ -1255,7 +1270,7 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('imag', """ - Imaginary part of the array. + The imaginary part of the array. Examples -------- @@ -1285,8 +1300,53 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('flags', - """Special object providing array flags. + """ + Information about the memory layout of the array. + Attributes + ---------- + C_CONTIGUOUS (C) + The data is in a single, C-style contiguous segment. + F_CONTIGUOUS (F) + The data is in a single, Fortran-style contiguous segment. + OWNDATA (O) + The array owns the memory it uses or borrows it from another object. + WRITEABLE (W) + The data area can be written to. + ALIGNED (A) + The data and strides are aligned appropriately for the hardware. + UPDATEIFCOPY (U) + This array is a copy of some other array. When this array is + deallocated, the base array will be updated with the contents of + this array. + + FNC + F_CONTIGUOUS and not C_CONTIGUOUS. + FORC + F_CONTIGUOUS or C_CONTIGUOUS (one-segment test). + BEHAVED (B) + ALIGNED and WRITEABLE. + CARRAY (CA) + BEHAVED and C_CONTIGUOUS. + FARRAY (FA) + BEHAVED and F_CONTIGUOUS and not C_CONTIGUOUS. + + Notes + ----- + The `flags` object can be also accessed dictionary-like, and using + lowercased attribute names. Short flag names are only supported in + dictionary access. + + Only the UPDATEIFCOPY, WRITEABLE, and ALIGNED flags can be changed by + the user, via assigning to ``flags['FLAGNAME']`` or `ndarray.setflags`. + The array flags cannot be set arbitrarily: + + - UPDATEIFCOPY can only be set ``False``. + - ALIGNED can only be set ``True`` if the data is truly aligned. + - WRITEABLE can only be set ``True`` if the array owns its own memory + or the ultimate owner of the memory exposes a writeable buffer + interface or is a string. + """)) @@ -1340,7 +1400,7 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('real', """ - Real part of the array. + The real part of the array. Examples -------- @@ -1500,7 +1560,7 @@ """ a.all(axis=None, out=None) - Check if all of the elements of `a` are true. + Returns True if all elements evaluate to True. Refer to `numpy.all` for full documentation. @@ -1542,7 +1602,7 @@ Returns ------- - index_array : {ndarray, int} + index_array : ndarray An array of indices or single index value, or a reference to `out` if it was specified. @@ -1609,11 +1669,42 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('byteswap', - """a.byteswap(False) -> View or copy. Swap the bytes in the array. + """ + a.byteswap(inplace) - Swap the bytes in the array. Return the byteswapped array. If the first - argument is True, byteswap in-place and return a reference to self. + Swap the bytes of the array elements + Toggle between low-endian and big-endian data representation by + returning a byteswapped array, optionally swapped in-place. + + Parameters + ---------- + inplace: bool, optional + If ``True``, swap bytes in-place, default is ``False``. + + Returns + ------- + out: ndarray + The byteswapped array. If `inplace` is ``True``, this is + a view to self. + + Examples + -------- + >>> A = np.array([1, 256, 8755], dtype=np.int16) + >>> map(hex, A) + ['0x1', '0x100', '0x2233'] + >>> A.byteswap(True) + array([ 256, 1, 13090], dtype=int16) + >>> map(hex, A) + ['0x100', '0x1', '0x3322'] + + Arrays of strings are not swapped + + >>> A = np.array(['ceg', 'fac']) + >>> A.byteswap() + array(['ceg', 'fac'], + dtype='|S3') + """)) @@ -1680,7 +1771,7 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('copy', """ - a.copy([order]) + a.copy(order='C') Return a copy of the array. @@ -1795,10 +1886,6 @@ value : scalar All elements of `a` will be assigned this value. - Returns - ------- - None - Examples -------- >>> a = np.array([1, 2]) @@ -1917,7 +2004,7 @@ """ a.nonzero() - Return the indices of the elements of a which are not zero. + Return the indices of the elements that are non-zero. Refer to `numpy.nonzero` for full documentation. @@ -1977,10 +2064,12 @@ """ putmask(a, mask, values) - Sets a.flat[n] = values[n] for each n where mask.flat[n] is true. + Changes elements of an array based on conditional and input values. + Sets `a`.flat[n] = `values`\\[n] for each n where `mask`.flat[n] is true. + If `values` is not the same size as `a` and `mask` then it will repeat. - This gives behavior different from a[mask] = values. + This gives behavior different from `a[mask] = values`. Parameters ---------- @@ -1993,7 +2082,7 @@ See Also -------- - put, take + place, put, take Examples -------- @@ -2050,7 +2139,7 @@ """ a.reshape(shape, order='C') - Returns an array containing the data of a, but with a new shape. + Returns an array containing the same data with a new shape. Refer to `numpy.reshape` for full documentation. @@ -2167,42 +2256,48 @@ Parameters ---------- - axis : integer - Axis to be sorted along. None indicates that the flattened array - should be used. Default is -1. - kind : string - Sorting algorithm to use. Possible values are 'quicksort', - 'mergesort', or 'heapsort'. Default is 'quicksort'. - order : list type or None - When a is an array with fields defined, this argument specifies + axis : int, optional + Axis along which to sort. Default is -1, which means sort along the + last axis. + kind : {'quicksort', 'mergesort', 'heapsort'}, optional + Sorting algorithm. Default is 'quicksort'. + order : list, optional + When `a` is an array with fields defined, this argument specifies which fields to compare first, second, etc. Not all fields need be specified. See Also -------- - argsort : indirect sort - lexsort : indirect stable sort on multiple keys - searchsorted : find keys in sorted array + numpy.sort : Return a sorted copy of an array. + argsort : Indirect sort. + lexsort : Indirect stable sort on multiple keys. + searchsorted : Find elements in sorted array. Notes ----- - The various sorts are characterized by average speed, worst case - performance, need for work space, and whether they are stable. A stable - sort keeps items with the same key in the same relative order. The three - available algorithms have the following properties: + See ``sort`` for notes on the different sorting algorithms. - =========== ======= ============= ============ ======= - kind speed worst case work space stable - =========== ======= ============= ============ ======= - 'quicksort' 1 O(n^2) 0 no - 'mergesort' 2 O(n*log(n)) ~n/2 yes - 'heapsort' 3 O(n*log(n)) 0 no - =========== ======= ============= ============ ======= + Examples + -------- + >>> a = np.array([[1,4], [3,1]]) + >>> a.sort(axis=1) + >>> a + array([[1, 4], + [1, 3]]) + >>> a.sort(axis=0) + >>> a + array([[1, 3], + [1, 4]]) - All the sort algorithms make temporary copies of the data when the sort is - not along the last axis. Consequently, sorts along the last axis are faster - and use less space than sorts along other axis. + Use the `order` keyword to specify a field to use when sorting a + structured array: + >>> a = np.array([('a', 2), ('c', 1)], dtype=[('x', 'S1'), ('y', int)]) + >>> a.sort(order='y') + >>> a + array([('c', 1), ('a', 2)], + dtype=[('x', '|S1'), ('y', '>> a = np.array([1, 2]) >>> a.tolist() [1, 2] >>> a = np.array([[1, 2], [3, 4]]) + >>> list(a) + [array([1, 2]), array([3, 4])] >>> a.tolist() [[1, 2], [3, 4]] @@ -2465,8 +2567,9 @@ """) -add_newdoc('numpy.core.umath','seterrobj', - """seterrobj() +add_newdoc('numpy.core.umath', 'seterrobj', + """ + seterrobj(errobj) Used internally by `seterr`. @@ -2481,8 +2584,9 @@ """) -add_newdoc("numpy.core","ufunc", - """Functions that operate element by element on whole arrays. +add_newdoc('numpy.core', 'ufunc', + """ + Functions that operate element by element on whole arrays. Unary ufuncs: ============= @@ -2492,13 +2596,14 @@ Parameters ---------- - X : array-like - out : array-like + X : array_like + Input array + out : array_like An array to store the output. Must be the same shape as X. Returns ------- - r : array-like + r : array_like r will have the same shape as X; if out is provided, r will be equal to out. @@ -2515,8 +2620,10 @@ Parameters ---------- - X : array-like - Y : array-like + X : array_like + First input array + Y : array_like + Second input array out : array-like An array to store the output. Must be the same shape as the output would have. @@ -2547,21 +2654,21 @@ Parameters ---------- - array : array-like + array : array_like The array to act on. - axis : integer + axis : integer, optional The axis along which to apply the reduction. - dtype : {data-type-code, None} + dtype : data-type-code, optional The type used to represent the intermediate results. Defaults to the data type of the output array if this is provided, or the data type of the input array if no output array is provided. - out : {array-like, None} + out : array_like, optional A location into which the result is stored. If not provided a freshly-allocated array is returned. Returns ------- - r : {array, scalar} + r : ndarray The reduced values. If out was supplied, r is equal to out. Examples @@ -2690,14 +2797,14 @@ Parameters ---------- - A : array-like + A : array_like First term - B : array-like + B : array_like Second term Returns ------- - r : array + r : ndarray Output array Examples Modified: trunk/numpy/core/arrayprint.py =================================================================== --- trunk/numpy/core/arrayprint.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/core/arrayprint.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -42,23 +42,23 @@ Parameters ---------- - precision : int + precision : int, optional Number of digits of precision for floating point output (default 8). - threshold : int + threshold : int, optional Total number of array elements which trigger summarization rather than full repr (default 1000). - edgeitems : int + edgeitems : int, optional Number of array items in summary at beginning and end of each dimension (default 3). - linewidth : int + linewidth : int, optional The number of characters per line for the purpose of inserting line breaks (default 75). - suppress : bool + suppress : bool, optional Whether or not suppress printing of small floating point values using scientific notation (default False). - nanstr : string + nanstr : string, optional String representation of floating point not-a-number (default nan). - infstr : string + infstr : string, optional String representation of floating point infinity (default inf). Examples @@ -242,7 +242,8 @@ The maximum number of columns the string should span. Newline characters splits the string appropriately after array elements. precision : int, optional - Floating point precision. + Floating point precision. Default is the current printing + precision (usually 8), which can be altered using `set_printoptions`. suppress_small : bool, optional Represent very small numbers as zero. separator : string, optional @@ -259,7 +260,7 @@ See Also -------- - array_str, array_repr + array_str, array_repr, set_printoptions Examples -------- Modified: trunk/numpy/core/code_generators/docstrings.py =================================================================== --- trunk/numpy/core/code_generators/docstrings.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/core/code_generators/docstrings.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -95,7 +95,7 @@ Returns ------- - angle : {ndarray, scalar} + angle : ndarray The angle of the ray intersecting the unit circle at the given `x`-coordinate in radians [0, pi]. If `x` is a scalar then a scalar is returned, otherwise an array of the same shape as `x` @@ -156,7 +156,7 @@ Returns ------- - out : {ndarray, scalar} + out : ndarray Array of the same shape and dtype as `x`. Notes @@ -198,7 +198,7 @@ Returns ------- - angle : {ndarray, scalar} + angle : ndarray The angle of the ray intersecting the unit circle at the given `y`-coordinate in radians ``[-pi, pi]``. If `x` is a scalar then a scalar is returned, otherwise an array is returned. @@ -263,7 +263,7 @@ For real-valued input data types, `arcsinh` always returns real output. For each value that cannot be expressed as a real number or infinity, it - yields ``nan`` and sets the `invalid` floating point error flag. + returns ``nan`` and sets the `invalid` floating point error flag. For complex-valued input, `arccos` is a complex analytical function that has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from @@ -294,12 +294,12 @@ Parameters ---------- - x : {array_like, scalar} + x : array_like Input values. `arctan` is applied to each element of `x`. Returns ------- - out : {ndarray, scalar} + out : ndarray Out has the same shape as `x`. Its real part is in ``[-pi/2, pi/2]``. It is a scalar if `x` is a scalar. @@ -363,15 +363,15 @@ Parameters ---------- - x1 : array-like, real-valued + x1 : array_like, real-valued y-coordinates. - x2 : array-like, real-valued + x2 : array_like, real-valued x-coordinates. `x2` must be broadcastable to match the shape of `x1`, or vice versa. Returns ------- - angle : array-like + angle : ndarray Array of angles in radians, in the range ``[-pi, pi]``. See Also @@ -726,7 +726,7 @@ Returns ------- - y : {ndarray, scalar} + y : ndarray The complex conjugate of `x`, with same dtype as `y`. Examples @@ -793,12 +793,12 @@ Parameters ---------- - x : array-like + x : array_like Angle in radians. Returns ------- - y : {ndarray, scalar} + y : ndarray The corresponding angle in degrees. @@ -964,8 +964,38 @@ add_newdoc('numpy.core.umath', 'expm1', """ - e**x-1 elementwise. + Return the exponential of the elements in the array minus one. + Parameters + ---------- + x : array_like + Input values. + + Returns + ------- + out : ndarray + Element-wise exponential minus one: ``out=exp(x)-1``. + + See Also + -------- + log1p : ``log(1+x)``, the inverse of expm1. + + + Notes + ----- + This function provides greater precision than using ``exp(x)-1`` + for small values of `x`. + + Examples + -------- + Since the series expansion of ``e**x = 1 + x + x**2/2! + x**3/3! + ...``, + for very small `x` we expect that ``e**x -1 ~ x + x**2/2``: + + >>> np.expm1(1e-10) + 1.00000000005e-10 + >>> np.exp(1e-10) - 1 + 1.000000082740371e-10 + """) add_newdoc('numpy.core.umath', 'fabs', @@ -1135,7 +1165,7 @@ add_newdoc('numpy.core.umath', 'greater_equal', """ - Returns (x1 >= x2) element-wise. + Element-wise True if first array is greater or equal than second array. Parameters ---------- @@ -1144,12 +1174,12 @@ Returns ------- - Out : {ndarray, bool} - Output array of bools, or a single bool if `x1` and `x2` are scalars. + out : ndarray, bool + Output array. See Also -------- - greater + greater, less, less_equal, equal Examples -------- @@ -1164,17 +1194,16 @@ Parameters ---------- - x : array-like + x : array_like Base of the triangle. - y : array-like + y : array_like Height of the triangle. Returns ------- - z : {ndarray, scalar} + z : ndarray Hypotenuse of the triangle: sqrt(x**2 + y**2) - Examples -------- >>> np.hypot(3,4) @@ -1277,66 +1306,182 @@ add_newdoc('numpy.core.umath', 'isfinite', """ - Returns True where x is finite, False otherwise. + Returns True for each element that is a finite number. + Shows which elements of the input are finite (not infinity or not + Not a Number). + Parameters ---------- x : array_like - input values + Input values. + y : array_like, optional + A boolean array with the same shape and type as `x` to store the result. Returns ------- - y : {ndarray, bool} - array of bools + y : ndarray, bool + For scalar input data, the result is a new numpy boolean with value True + if the input data is finite; otherwise the value is False (input is + either positive infinity, negative infinity or Not a Number). + For array input data, the result is an numpy boolean array with the same + dimensions as the input and the values are True if the corresponding + element of the input is finite; otherwise the values are False (element + is either positive infinity, negative infinity or Not a Number). If the + second argument is supplied then an numpy integer array is returned with + values 0 or 1 corresponding to False and True, respectively. + + See Also + -------- + isinf : Shows which elements are negative or negative infinity. + isneginf : Shows which elements are negative infinity. + isposinf : Shows which elements are positive infinity. + isnan : Shows which elements are Not a Number (NaN). + + Notes ----- - `Nan` is considered as non-finite. + Not a Number, positive infinity and negative infinity are considered + to be non-finite. + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Also that positive infinity is not equivalent to negative infinity. But + infinity is equivalent to positive infinity. + + Errors result if second argument is also supplied with scalar input or + if first and second arguments have different shapes. + Examples -------- + >>> np.isfinite(1) + True + >>> np.isfinite(0) + True + >>> np.isfinite(np.nan) + False + >>> np.isfinite(np.inf) + False + >>> np.isfinite(np.NINF) + False >>> np.isfinite([np.log(-1.),1.,np.log(0)]) array([False, True, False], dtype=bool) + >>> x=np.array([-np.inf, 0., np.inf]) + >>> y=np.array([2,2,2]) + >>> np.isfinite(x,y) + array([0, 1, 0]) + >>> y + array([0, 1, 0]) """) add_newdoc('numpy.core.umath', 'isinf', """ - Returns True where x is +inf or -inf, False otherwise. + Shows which elements of the input are positive or negative infinity. + Returns a numpy boolean scalar or array resulting from an element-wise test + for positive or negative infinity. Parameters ---------- x : array_like input values + y : array_like, optional + An array with the same shape as `x` to store the result. Returns ------- y : {ndarray, bool} - array of bools + For scalar input data, the result is a new numpy boolean with value True + if the input data is positive or negative infinity; otherwise the value + is False. + For array input data, the result is an numpy boolean array with the same + dimensions as the input and the values are True if the corresponding + element of the input is positive or negative infinity; otherwise the + values are False. If the second argument is supplied then an numpy + integer array is returned with values 0 or 1 corresponding to False and + True, respectively. + + See Also + -------- + isneginf : Shows which elements are negative infinity. + isposinf : Shows which elements are positive infinity. + isnan : Shows which elements are Not a Number (NaN). + isfinite: Shows which elements are not: Not a number, positive and + negative infinity + + Notes + ----- + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Also that positive infinity is not equivalent to negative infinity. But + infinity is equivalent to positive infinity. + + Errors result if second argument is also supplied with scalar input or + if first and second arguments have different shapes. + + Numpy's definitions for positive infinity (PINF) and negative infinity + (NINF) may be change in the future versions. + Examples -------- + >>> np.isinf(np.inf) + True + >>> np.isinf(np.nan) + False + >>> np.isinf(np.NINF) + True >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) array([ True, True, False, False], dtype=bool) + >>> x=np.array([-np.inf, 0., np.inf]) + >>> y=np.array([2,2,2]) + >>> np.isinf(x,y) + array([1, 0, 1]) + >>> y + array([1, 0, 1]) """) add_newdoc('numpy.core.umath', 'isnan', """ - Returns True where elements are Not-A-Number, False otherwise. + Returns a numpy boolean scalar or array resulting from an element-wise test + for Not a Number (NaN). Parameters ---------- x : array_like - input values. + input data. Returns ------- y : {ndarray, bool} - array of bools + For scalar input data, the result is a new numpy boolean with value True + if the input data is NaN; otherwise the value is False. + For array input data, the result is an numpy boolean array with the same + dimensions as the input and the values are True if the corresponding + element of the input is Not a Number; otherwise the values are False. + + See Also + -------- + isinf : Tests for infinity. + isneginf : Tests for negative infinity. + isposinf : Tests for positive infinity. + isfinite : Shows which elements are not: Not a number, positive infinity + and negative infinity + + Notes + ----- + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Examples -------- + >>> np.isnan(np.nan) + True + >>> np.isnan(np.inf) + False >>> np.isnan([np.log(-1.),1.,np.log(0)]) array([ True, False, False], dtype=bool) @@ -1344,8 +1489,35 @@ add_newdoc('numpy.core.umath', 'left_shift', """ - Computes x1 << x2 (x1 shifted to left by x2 bits) elementwise. + Shift the bits of an integer to the left. + Bits are shifted to the left by appending `x2` 0s at the right of `x1`. + Since the internal representation of numbers is in binary format, this + operation is equivalent to multiplying `x1` by ``2**x2``. + + Parameters + ---------- + x1 : array_like of integer type + Input values. + x2 : array_like of integer type + Number of zeros to append to `x1`. + + Returns + ------- + out : array of integer type + Return `x1` with bits shifted `x2` times to the left. + + See Also + -------- + right_shift : Shift the bits of an integer to the right. + binary_repr : Return the binary representation of the input number + as a string. + + Examples + -------- + >>> np.left_shift(5, [1,2,3]) + array([10, 20, 40]) + """) add_newdoc('numpy.core.umath', 'less', @@ -1354,7 +1526,7 @@ Parameters ---------- - x1, x2 : array-like + x1, x2 : array_like Input arrays. Returns @@ -1408,12 +1580,12 @@ Parameters ---------- x : array_like - Input value. + Input value. Returns ------- - y : {ndarray, scalar} - The natural logarithm of `x`, element-wise. + y : ndarray + The natural logarithm of `x`, element-wise. See Also -------- @@ -1449,19 +1621,18 @@ add_newdoc('numpy.core.umath', 'log10', """ - Compute the logarithm in base 10 elementwise. + Compute the logarithm in base 10 element-wise. Parameters ---------- x : array_like - input values. + Input values. Returns ------- - y : {ndarray, scalar} - base-10 logarithm of `x`. + y : ndarray + Base-10 logarithm of `x`. - Notes ----- Logarithm is a multivalued function: for each `x` there is an infinite @@ -1501,7 +1672,7 @@ Returns ------- - y : {ndarray, scalar} + y : ndarray Natural logarithm of `1 + x`, elementwise. Notes @@ -1674,14 +1845,80 @@ add_newdoc('numpy.core.umath', 'maximum', """ - Returns maximum (if x1 > x2: x1; else: x2) elementwise. + Element-wise maximum of array elements. + Compare two arrays and returns a new array containing + the element-wise maxima. + + Parameters + ---------- + x1, x2 : array_like + The arrays holding the elements to be compared. + + Returns + ------- + y : {ndarray, scalar} + The maximum of `x1` and `x2`, element-wise. Returns scalar if + both `x1` and `x2` are scalars. + + See Also + -------- + minimum : + element-wise minimum + + Notes + ----- + Equivalent to ``np.where(x1 > x2, x1, x2)`` but faster and does proper + broadcasting. + + Examples + -------- + >>> np.maximum([2, 3, 4], [1, 5, 2]) + array([2, 5, 4]) + + >>> np.maximum(np.eye(2), [0.5, 2]) + array([[ 1. , 2. ], + [ 0.5, 2. ]]) + """) add_newdoc('numpy.core.umath', 'minimum', """ - Returns minimum (if x1 < x2: x1; else: x2) elementwise + Element-wise minimum of array elements. + Compare two arrays and returns a new array containing + the element-wise minima. + + Parameters + ---------- + x1, x2 : array_like + The arrays holding the elements to be compared. + + Returns + ------- + y : {ndarray, scalar} + The minimum of `x1` and `x2`, element-wise. Returns scalar if + both `x1` and `x2` are scalars. + + See Also + -------- + maximum : + element-wise maximum + + Notes + ----- + Equivalent to ``np.where(x1 < x2, x1, x2)`` but faster and does proper + broadcasting. + + Examples + -------- + >>> np.minimum([2, 3, 4], [1, 5, 2]) + array([1, 3, 2]) + + >>> np.minimum(np.eye(2), [0.5, 2]) + array([[ 0.5, 0. ], + [ 0. , 1. ]]) + """) add_newdoc('numpy.core.umath', 'modf', @@ -1718,12 +1955,12 @@ Parameters ---------- - x1, x2 : array-like + x1, x2 : array_like The arrays to be multiplied. Returns ------- - y : {ndarray, scalar} + y : ndarray The product of `x1` and `x2`, elementwise. Returns a scalar if both `x1` and `x2` are scalars. @@ -1797,7 +2034,7 @@ add_newdoc('numpy.core.umath', 'ones_like', """ - Returns an array of zeros with the same shape and type as a given array. + Returns an array of ones with the same shape and type as a given array. Equivalent to ``a.copy().fill(1)``. @@ -1818,7 +2055,7 @@ add_newdoc('numpy.core.umath', 'power', """ - Computes `x1` ** `x2` elementwise. + Returns element-wise base array raised to power from second array. Raise each base in `x1` to the power of the exponents in `x2`. This requires that `x1` and `x2` must be broadcastable to the same shape. @@ -1874,7 +2111,7 @@ Returns ------- - y : {ndarray, scalar} + y : ndarray The corresponding angle in radians. See Also @@ -1895,7 +2132,7 @@ add_newdoc('numpy.core.umath', 'reciprocal', """ - Compute 1/x. + Return element-wise reciprocal. Parameters ---------- @@ -1904,7 +2141,7 @@ Returns ------- - y : {ndarray, scalar} + y : ndarray Return value. Examples @@ -1918,8 +2155,10 @@ add_newdoc('numpy.core.umath', 'remainder', """ - Computes x1-n*x2 where n is floor(x1 / x2) + Returns element-wise remainder of division. + Computes `x1 - floor(x1/x2)*x2`. + Parameters ---------- x1 : array_like @@ -1929,9 +2168,9 @@ Returns ------- - y : {ndarray, scalar} - The quotient `x1/x2`, element-wise. Returns a scalar if - both `x1` and `x2` are scalars. + y : ndarray + The remainder of the quotient `x1/x2`, element-wise. Returns a scalar + if both `x1` and `x2` are scalars. See Also -------- @@ -1951,8 +2190,35 @@ add_newdoc('numpy.core.umath', 'right_shift', """ - Computes x1 >> x2 (x1 shifted to right by x2 bits) elementwise. + Shift the bits of an integer to the right. + Bits are shifted to the right by removing `x2` bits at the right of `x1`. + Since the internal representation of numbers is in binary format, this + operation is equivalent to dividing `x1` by ``2**x2``. + + Parameters + ---------- + x1 : array_like, int + Input values. + x2 : array_like, int + Number of bits to remove at the right of `x1`. + + Returns + ------- + out : ndarray, int + Return `x1` with bits shifted `x2` times to the right. + + See Also + -------- + left_shift : Shift the bits of an integer to the left. + binary_repr : Return the binary representation of the input number + as a string. + + Examples + -------- + >>> np.right_shift(10, [1,2,3]) + array([5, 2, 1]) + """) add_newdoc('numpy.core.umath', 'rint', @@ -1979,9 +2245,9 @@ add_newdoc('numpy.core.umath', 'sign', """ - Return the sign of a number. + Returns an element-wise indication of the sign of a number. - -1 if x < 0, 0 if x==0, 1 if x > 0. + The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. Parameters ---------- @@ -1990,7 +2256,7 @@ Returns ------- - y : {ndarray, scalar} + y : ndarray The sign of `x`. Examples @@ -2004,20 +2270,23 @@ add_newdoc('numpy.core.umath', 'signbit', """ - Returns True where `signbit` of `x` is set (`x<0`). + Returns element-wise True where signbit is set (less than zero). Parameters ---------- - x: array-like or scalar - the input value(s). - output : array-like or scalar - the returned boolean(s) + x: array_like + The input value(s). + Returns + ------- + out : array_like, bool + Output. + Examples -------- >>> np.signbit(-1.2) True - >>> np.signbit(np.array([1,-2.3,2.1])) + >>> np.signbit(np.array([1, -2.3, 2.1])) array([False, True, False], dtype=bool) """) @@ -2138,18 +2407,18 @@ add_newdoc('numpy.core.umath', 'square', """ - Compute `x` squared, or `x` to the power of two. + Return the element-wise square of the input. Parameters ---------- - x : array_like or scalar + x : array_like Input data. Returns ------- - out : ndarray or scalar + out : ndarray Element-wise `x*x`, of the same shape and dtype as `x`. - `out` is a scalar if `x` is a scalar. + Returns scalar if `x` is a scalar. See Also -------- @@ -2166,18 +2435,18 @@ add_newdoc('numpy.core.umath', 'subtract', """ - Subtract arguments elementwise. + Subtract arguments element-wise. Parameters ---------- - x1, x2 : {array_like, scalar} + x1, x2 : array_like The arrays to be subtracted from each other. If type is 'array_like' the `x1` and `x2` shapes must be identical. Returns ------- - y : {ndarray, scalar} - The difference of `x1` and `x2`, elementwise. Returns a scalar if + y : ndarray + The difference of `x1` and `x2`, element-wise. Returns a scalar if both `x1` and `x2` are scalars. Notes @@ -2200,7 +2469,7 @@ add_newdoc('numpy.core.umath', 'tan', """ - Compute tangent elementwise. + Compute tangent element-wise. Parameters ---------- @@ -2209,7 +2478,7 @@ Returns ------- - y : ndarray or scalar + y : ndarray The corresponding tangent values. @@ -2223,7 +2492,7 @@ add_newdoc('numpy.core.umath', 'tanh', """ - Hyperbolic tangent elementwise. + Hyperbolic tangent element-wise. Parameters ---------- @@ -2232,14 +2501,14 @@ Returns ------- - y : ndarray or scalar + y : ndarray The corresponding hyperbolic tangent values. """) add_newdoc('numpy.core.umath', 'true_divide', """ - Returns an elementwise, true division of the inputs. + Returns an element-wise, true division of the inputs. Instead of the Python traditional 'floor division', this returns a true division. True division adjusts the output type to present the best @@ -2254,7 +2523,7 @@ Returns ------- - out : {ndarray, scalar} + out : ndarray Result is scalar if both inputs are scalar, ndarray otherwise. Notes Modified: trunk/numpy/core/defchararray.py =================================================================== --- trunk/numpy/core/defchararray.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/core/defchararray.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -16,6 +16,20 @@ # comparisons class chararray(ndarray): + """ + chararray(shape, itemsize=1, unicode=False, buffer=None, offset=0, + strides=None, order=None) + + A character array of string or unicode type. + + The array items will be `itemsize` characters long. + + Create the array using buffer (with offset and strides) if it is + not None. If buffer is None, then construct a new array with strides + in Fortran order if len(shape) >=2 and order is 'Fortran' (otherwise + the strides will be in 'C' order). + + """ def __new__(subtype, shape, itemsize=1, unicode=False, buffer=None, offset=0, strides=None, order='C'): global _globalvar Modified: trunk/numpy/core/fromnumeric.py =================================================================== --- trunk/numpy/core/fromnumeric.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/core/fromnumeric.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -44,17 +44,17 @@ def take(a, indices, axis=None, out=None, mode='raise'): """ - Take elements from an array along a given axis. + Take elements from an array along an axis. This function does the same thing as "fancy" indexing (indexing arrays - using arrays); however, it can be easier to use if you need to specify - a given axis. + using arrays); however, it can be easier to use if you need elements + along a given axis. Parameters ---------- - a : ndarray + a : array_like The source array. - indices : int array + indices : array_like, int The indices of the values to extract. axis : int, optional The axis over which to select values. By default, the @@ -77,6 +77,18 @@ -------- ndarray.take : equivalent method + Examples + -------- + >>> a = [4, 3, 5, 7, 6, 8] + >>> indices = [0, 1, 4] + >>> np.take(a, indices) + array([4, 3, 6]) + + In this example if `a` is a ndarray, "fancy" indexing can be used. + >>> a = np.array(a) + >>> a[indices] + array([4, 3, 6]) + """ try: take = a.take @@ -88,15 +100,17 @@ # not deprecated --- copy if necessary, view otherwise def reshape(a, newshape, order='C'): """ - Returns an array containing the data of a, but with a new shape. + Gives a new shape to an array without changing its data. Parameters ---------- - a : ndarray + a : array_like Array to be reshaped. newshape : {tuple, int} - The new shape should be compatible with the original shape. If an - integer, then the result will be a 1-D array of that length. + The new shape should be compatible with the original shape. If + an integer, then the result will be a 1-D array of that length. + One shape dimension can be -1. In this case, the value is inferred + from the length of the array and remaining dimensions. order : {'C', 'F'}, optional Determines whether the array data should be viewed as in C (row-major) order or FORTRAN (column-major) order. @@ -113,16 +127,15 @@ Examples -------- - >>> a = np.array([[1,2], [3,4]]) - >>> a.reshape(4) - array([1, 2, 3, 4]) - >>> a.reshape(4, order='F') - array([1, 3, 2, 4]) - >>> a.reshape((4,1)) - array([[1], - [2], - [3], - [4]]) + >>> a = np.array([[1,2,3], [4,5,6]]) + >>> np.reshape(a, 6) + array([1, 2, 3, 4, 5, 6]) + >>> np.reshape(a, 6, order='F') + array([1, 4, 2, 5, 3, 6]) + >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 + array([[1, 2], + [3, 4], + [5, 6]]) """ try: @@ -236,9 +249,10 @@ def put(a, ind, v, mode='raise'): """ - Set a.flat[n] = v[n] for all n in ind. + Changes specific elements of one array by replacing from another array. - If `v` is shorter than `ind`, it will repeat. + Set `a`.flat[n] = `v`\\[n] for all n in `ind`. If `v` is shorter than + `ind`, it will repeat which is different than `a[ind]` = `v`. Parameters ---------- @@ -379,28 +393,29 @@ Parameters ---------- - a : array-like + a : array_like Array to be sorted. - axis : int, optional - Axis along which to sort. If not specified, the flattened array - is used. + axis : int or None, optional + Axis along which to sort. If None, the array is flattened before + sorting. The default is -1, which sorts along the last axis. kind : {'quicksort', 'mergesort', 'heapsort'}, optional - Sorting algorithm. + Sorting algorithm. Default is 'quicksort'. order : list, optional - When `a` is an ndarray with fields defined, this argument specifies - which fields to compare first, second, etc. Not all fields need be - specified. + When `a` is a structured array, this argument specifies which fields + to compare first, second, and so on. This list does not need to + include all of the fields. Returns ------- sorted_array : ndarray - Array of same type and shape as `a`. + Array of the same type and shape as `a`. See Also -------- + ndarray.sort : Method to sort an array in-place. argsort : Indirect sort. lexsort : Indirect stable sort on multiple keys. - searchsorted : Find keys in sorted array. + searchsorted : Find elements in a sorted array. Notes ----- @@ -425,16 +440,35 @@ Examples -------- - >>> a=np.array([[1,4],[3,1]]) - >>> a.sort(1) - >>> a + >>> a = np.array([[1,4],[3,1]]) + >>> np.sort(a) # sort along the last axis array([[1, 4], [1, 3]]) - >>> a.sort(0) - >>> a - array([[1, 3], - [1, 4]]) + >>> np.sort(a, axis=None) # sort the flattened array + array([1, 1, 3, 4]) + >>> np.sort(a, axis=0) # sort along the first axis + array([[1, 1], + [3, 4]]) + Use the `order` keyword to specify a field to use when sorting a + structured array: + + >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] + >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), + ... ('Galahad', 1.7, 38)] + >>> a = np.array(values, dtype=dtype) # create a structured array + >>> np.sort(a, order='height') # doctest: +SKIP + array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), + ('Lancelot', 1.8999999999999999, 38)], + dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP + array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), + ('Arthur', 1.8, 41)], + dtype=[('name', '|S10'), ('height', '>> np.shape(0) () - >>> x = np.array([(1,2),(3,4)], dtype=[('x', 'i4'), ('y', 'i4')]) - >>> np.shape(x) + >>> a = np.array([(1,2),(3,4)], dtype=[('x', 'i4'), ('y', 'i4')]) + >>> np.shape(a) (2,) - >>> x.shape + >>> a.shape (2,) """ @@ -1013,24 +1054,29 @@ Parameters ---------- - condition : {array} - Boolean 1-d array selecting which entries to return. If len(condition) - is less than the size of a along the axis, then output is truncated - to length of condition array. - a : {array_type} + condition : array_like + Boolean 1-D array selecting which entries to return. If len(condition) + is less than the size of `a` along the given axis, then output is + truncated to the length of the condition array. + a : array_like Array from which to extract a part. - axis : {None, integer} - Axis along which to take slices. If None, work on the flattened array. - out : array, optional + axis : int, optional + Axis along which to take slices. If None (default), work on the + flattened array. + out : ndarray, optional Output array. Its type is preserved and it must be of the right shape to hold the output. Returns ------- - compressed_array : array + compressed_array : ndarray A copy of `a` without the slices along axis for which `condition` is false. + See Also + -------- + ndarray.compress: Equivalent method. + Examples -------- >>> a = np.array([[1, 2], [3, 4]]) @@ -1127,7 +1173,7 @@ Returns ------- - sum_along_axis : ndarray or scalar + sum_along_axis : ndarray An array with the same shape as `a`, with the specified axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar is returned. If an output array is specified, a reference to @@ -1208,14 +1254,11 @@ def alltrue (a, axis=None, out=None): """ - Check if all of the elements of `a` are true. + Check if all elements of input array are true. - Please refer to the `numpy.all` documentation. `numpy.all` is - the same function. - See Also -------- - numpy.all : equivalent function + numpy.all : Equivalent function; see for details. """ try: @@ -1227,7 +1270,7 @@ def any(a,axis=None, out=None): """ - Test whether any elements of an array evaluate to true along a given axis. + Test whether any elements of an array evaluate to True along an axis. Parameters ---------- @@ -1278,7 +1321,7 @@ def all(a,axis=None, out=None): """ - Test whether all elements of an array evaluate to true along a given axis. + Returns True if all elements evaluate to True. Parameters ---------- @@ -1293,7 +1336,7 @@ Returns ------- - out : ndarray + out : ndarray, bool A logical AND is performed along `axis`, and the result placed in `out`. If `out` was not specified, a new output array is created. @@ -1333,7 +1376,7 @@ Parameters ---------- - a : array-like + a : array_like Input array or object that can be converted to an array. axis : int, optional Axis along which the cumulative sum is computed. The default @@ -1403,8 +1446,10 @@ def ptp(a, axis=None, out=None): """ - Peak to peak (maximum - minimum) value along a given axis. + Range of values (maximum - minimum) along an axis. + The name of the function comes from the acronym for 'peak to peak'. + Parameters ---------- a : array_like @@ -1526,7 +1571,7 @@ def alen(a): """ - Return the length of an array_like as an array of at least 1 dimension. + Return the length of the first dimension of the input array. Parameters ---------- @@ -1538,12 +1583,16 @@ alen : int Length of the first dimension of `a`. + See Also + -------- + shape + Examples -------- - >>> z = np.zeros((7,4,5)) - >>> z.shape[0] + >>> a = np.zeros((7,4,5)) + >>> a.shape[0] 7 - >>> np.alen(z) + >>> np.alen(a) 7 """ @@ -1567,8 +1616,8 @@ dtype : data-type, optional The data-type of the returned array, as well as of the accumulator in which the elements are multiplied. By default, if `a` is of - integer type, `dtype` is the default platform integer (note: if - the type of `a` is unsigned, then so is `dtype`). Otherwise, + integer type, `dtype` is the default platform integer. (Note: if + the type of `a` is unsigned, then so is `dtype`.) Otherwise, the dtype is the same as that of `a`. out : ndarray, optional Alternative output array in which to place the result. It must have @@ -1577,7 +1626,7 @@ Returns ------- - product_along_axis : {ndarray, scalar}, see `dtype` parameter above. + product_along_axis : ndarray, see `dtype` parameter above. An array shaped as `a` but with the specified axis removed. Returns a reference to `out` if specified. @@ -1846,9 +1895,9 @@ Returns ------- - rounded_array : {array} + rounded_array : ndarray An array of the same type as `a`, containing the rounded values. - Unless `a` was specified, a new array is created. A reference to + Unless `out` was specified, a new array is created. A reference to the result is returned. The real and imaginary parts of complex numbers are rounded Modified: trunk/numpy/core/numeric.py =================================================================== --- trunk/numpy/core/numeric.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/core/numeric.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -305,7 +305,7 @@ Parameters ---------- - a : array-like + a : array_like Input array. dtype : data-type, optional By default, the data-type is inferred from the input data. @@ -339,7 +339,7 @@ Parameters ---------- - a : array-like + a : array_like The object to be converted to a type-and-requirement satisfying array dtype : data-type The required data-type (None is the default data-type -- float64) @@ -403,15 +403,42 @@ return a.flags.fnc def argwhere(a): - """Return a 2-d array of shape N x a.ndim where each row - is a sequence of indices into a. This sequence must be - converted to a tuple in order to be used to index into a. + """ + Find the indices of array elements that are non-zero, grouped by element. - >>> np.argwhere(np.ones((2, 2))) - array([[0, 0], - [0, 1], + Parameters + ---------- + a : array_like + Input data. + + Returns + ------- + index_array : ndarray + Indices of elements that are non-zero. Indices are grouped by element. + + See Also + -------- + where, nonzero + + Notes + ----- + ``np.argwhere(a)`` is the same as ``np.transpose(np.nonzero(a))``. + + The output of ``argwhere`` is not suitable for indexing arrays. + For this purpose use ``where(a)`` instead. + + Examples + -------- + >>> x = np.arange(6).reshape(2,3) + >>> x + array([[0, 1, 2], + [3, 4, 5]]) + >>> np.argwhere(x>1) + array([[0, 2], [1, 0], - [1, 1]]) + [1, 1], + [1, 2]]) + """ return asarray(a.nonzero()).T @@ -635,6 +662,13 @@ dot(`a`, `b`). If the first argument is complex the complex conjugate of the first argument is used for the calculation of the dot product. + For 2-D arrays it is equivalent to matrix multiplication, and for 1-D + arrays to inner product of vectors (with complex conjugation of `a`). + For N dimensions it is a sum product over the last axis of `a` and + the second-to-last of `b`:: + + dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) + Parameters ---------- a : array_like @@ -645,7 +679,7 @@ Returns ------- - output : scalar + output : ndarray Returns dot product of `a` and `b`. Can be an int, float, or complex depending on the types of `a` and `b`. @@ -726,7 +760,7 @@ def tensordot(a, b, axes=2): """ - Returns the tensor dot product for (ndim >= 1) arrays along specified axes. + Returns the tensor dot product for (ndim >= 1) arrays along an axes. The first element of the sequence determines the axis or axes in `a` to sum over, and the second element in `axes` argument sequence @@ -1109,40 +1143,52 @@ def indices(dimensions, dtype=int): """ - Return an array representing the coordinates of a grid. + Return an array representing the indices of a grid. + Compute an array where the subarrays contain index values 0,1,... + varying only along the corresponding axis. + Parameters ---------- - shape : (N,) tuple of ints + dimensions : sequence of ints + The shape of the grid. + dtype : optional + Data_type of the result. Returns ------- grid : ndarray - The output shape is ``(N,) + shape``. I.e., if `shape` is ``(2,4,5)``, - the output shape is ``(3, 2, 4, 5)``. Each subarray, ``grid[i,...]`` - contains values that vary only along the ``i-th`` axis. + The array of grid indices, + ``grid.shape = (len(dimensions),) + tuple(dimensions)``. + See Also + -------- + mgrid, meshgrid + + Notes + ----- + The output shape is obtained by prepending the number of dimensions + in front of the tuple of dimensions, i.e. if `dimensions` is a tuple + ``(r0, ..., rN-1)`` of length ``N``, the output shape is + ``(N,r0,...,rN-1)``. + + The subarrays ``grid[k]`` contains the N-D array of indices along the + ``k-th`` axis. Explicitly:: + + grid[k,i0,i1,...,iN-1] = ik + Examples -------- >>> grid = np.indices((2,3)) - - The row-positions are given by: - - >>> grid[0] + >>> grid.shape + (2,2,3) + >>> grid[0] # row indices array([[0, 0, 0], [1, 1, 1]]) - - and the column-positions by - - >>> grid[1] + >>> grid[1] # column indices array([[0, 1, 2], [0, 1, 2]]) - - See Also - -------- - mgrid, meshgrid, ndindex - """ dimensions = tuple(dimensions) N = len(dimensions) @@ -1491,7 +1537,7 @@ def allclose(a, b, rtol=1.e-5, atol=1.e-8): """ - Returns True if all elements are equal subject to given tolerances. + Returns True if two arrays are element-wise equal within a tolerance. The tolerance values are positive, typically very small numbers. The relative difference (`rtol` * `b`) and the absolute difference (`atol`) @@ -1507,18 +1553,34 @@ atol : Absolute tolerance The absolute difference is equal to `atol`. + Returns + ------- + y : bool + Returns True if the two arrays are equal within the given + tolerance; False otherwise. If either array contains NaN, then + False is returned. + See Also -------- all, any, alltrue, sometrue + Notes + ----- + If the following equation is element-wise True, then allclose returns + True. + + absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) + Examples -------- - >>> allclose(array([1e10,1e-7]), array([1.00001e10,1e-8])) + >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) False - >>> allclose(array([1e10,1e-8]), array([1.00001e10,1e-9])) + >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) True - >>> allclose(array([1e10,1e-8]), array([1.0001e10,1e-9])) + >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) False + >>> np.allclose([1.0, np.nan], [1.0, np.nan]) + False """ x = array(a, copy=False) @@ -1540,9 +1602,9 @@ Parameters ---------- - a1 : array-like + a1 : array_like First input array. - a2 : array-like + a2 : array_like Second input array. Returns @@ -1571,10 +1633,33 @@ return bool(logical_and.reduce(equal(a1,a2).ravel())) def array_equiv(a1, a2): - """Returns True if a1 and a2 are shape consistent - (mutually broadcastable) and have all elements equal and False - otherwise. """ + Returns True if input arrays are shape consistent and all elements equal. + + Parameters + ---------- + a1 : array_like + Input array. + a2 : array_like + Input array. + + Returns + ------- + out : bool + True if equivalent, False otherwise. + + Examples + -------- + >>> np.array_equiv([1,2],[1,2]) + >>> True + >>> np.array_equiv([1,2],[1,3]) + >>> False + >>> np.array_equiv([1,2], [[1,2],[1,2]]) + >>> True + >>> np.array_equiv([1,2], [[1,2],[1,3]]) + >>> False + + """ try: a1, a2 = asarray(a1), asarray(a2) except: @@ -1598,31 +1683,73 @@ del key def seterr(all=None, divide=None, over=None, under=None, invalid=None): - """Set how floating-point errors are handled. + """ + Set how floating-point errors are handled. - Valid values for each type of error are the strings - "ignore", "warn", "raise", and "call". Returns the old settings. - If 'all' is specified, values that are not otherwise specified - will be set to 'all', otherwise they will retain their old - values. - Note that operations on integer scalar types (such as int16) are handled like floating point, and are affected by these settings. - Example: + Parameters + ---------- + all : {'ignore', 'warn', 'raise', 'call'}, optional + Set treatment for all types of floating-point errors at once: + - ignore: Take no action when the exception occurs + - warn: Print a RuntimeWarning (via the Python `warnings` module) + - raise: Raise a FloatingPointError + - call: Call a function specified using the `seterrcall` function. + + The default is not to change the current behavior. + divide : {'ignore', 'warn', 'raise', 'call'}, optional + Treatment for division by zero. + over : {'ignore', 'warn', 'raise', 'call'}, optional + Treatment for floating-point overflow. + under : {'ignore', 'warn', 'raise', 'call'}, optional + Treatment for floating-point underflow. + invalid : {'ignore', 'warn', 'raise', 'call'}, optional + Treatment for invalid floating-point operation. + + Returns + ------- + old_settings : dict + Dictionary containing the old settings. + + See also + -------- + seterrcall : set a callback function for the 'call' mode. + geterr, geterrcall + + Notes + ----- + The floating-point exceptions are defined in the IEEE 754 standard [1]: + + - Division by zero: infinite result obtained from finite numbers. + - Overflow: result too large to be expressed. + - Underflow: result so close to zero that some precision + was lost. + - Invalid operation: result is not an expressible number, typically + indicates that a NaN was produced. + + .. [1] http://en.wikipedia.org/wiki/IEEE_754 + + Examples + -------- + + Set mode: + >>> seterr(over='raise') # doctest: +SKIP - {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'} + {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', + 'under': 'ignore'} - >>> seterr(all='warn', over='raise') # doctest: +SKIP - {'over': 'raise', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'} + >>> old_settings = seterr(all='warn', over='raise') # doctest: +SKIP >>> int16(32000) * int16(3) # doctest: +SKIP Traceback (most recent call last): File "", line 1, in ? FloatingPointError: overflow encountered in short_scalars >>> seterr(all='ignore') # doctest: +SKIP - {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'} + {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', + 'under': 'ignore'} """ @@ -1665,8 +1792,15 @@ return res def setbufsize(size): - """Set the size of the buffer used in ufuncs. """ + Set the size of the buffer used in ufuncs. + + Parameters + ---------- + size : int + Size of buffer. + + """ if size > 10e6: raise ValueError, "Buffer size, %s, is too big." % size if size < 5: Modified: trunk/numpy/core/numerictypes.py =================================================================== --- trunk/numpy/core/numerictypes.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/core/numerictypes.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -662,7 +662,8 @@ def find_common_type(array_types, scalar_types): - """Determine common type following standard coercion rules + """ + Determine common type following standard coercion rules Parameters ---------- @@ -679,6 +680,11 @@ is of a different kind. If the kinds is not understood, then None is returned. + + See Also + -------- + dtype + """ array_types = [dtype(x) for x in array_types] scalar_types = [dtype(x) for x in scalar_types] Modified: trunk/numpy/doc/basics.py =================================================================== --- trunk/numpy/doc/basics.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/doc/basics.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -132,6 +132,4 @@ value is inside an array or not. NumPy scalars also have many of the same methods arrays do. -See xxx for details. - """ Modified: trunk/numpy/doc/creation.py =================================================================== --- trunk/numpy/doc/creation.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/doc/creation.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -1,6 +1,6 @@ """ ============== -Array creation +Array Creation ============== Introduction @@ -18,17 +18,15 @@ expanding or mutating existing arrays. Nor will it cover creating object arrays or record arrays. Both of those are covered in their own sections. -Converting Python array-like objects to numpy arrays +Converting Python array_like Objects to Numpy Arrays ==================================================== In general, numerical data arranged in an array-like structure in Python can be converted to arrays through the use of the array() function. The most obvious examples are lists and tuples. See the documentation for array() for details for -its use. Some -objects may support the array-protocol and allow conversion to arrays this -way. A simple way to find out if the object can be converted to a numpy array -using array() is simply to try it interactively and see if it works! (The -Python Way). +its use. Some objects may support the array-protocol and allow conversion to arrays +this way. A simple way to find out if the object can be converted to a numpy array +using array() is simply to try it interactively and see if it works! (The Python Way). Examples: :: @@ -37,7 +35,7 @@ >>> x = np.array([[1,2.0],[0,0],(1+1j,3.)]) # note mix of tuple and lists, and types >>> x = np.array([[ 1.+0.j, 2.+0.j], [ 0.+0.j, 0.+0.j], [ 1.+1.j, 3.+0.j]]) -Intrinsic numpy array creation +Intrinsic Numpy Array Creation ============================== Numpy has built-in functions for creating arrays from scratch: @@ -65,6 +63,17 @@ Note that there are some subtleties regarding the last usage that the user should be aware of that are described in the arange docstring. +linspace() will create arrays with a specified number of elements, and +spaced equally between the specified beginning and end values. For +example: :: + + >>> np.linspace(1., 4., 6) + array([ 1. , 1.6, 2.2, 2.8, 3.4, 4. ]) + +The advantage of this creation function is that one can guarantee the +number of elements and the starting and end point, which arange() +generally will not do for arbitrary start, stop, and step values. + indices() will create a set of arrays (stacked as a one-higher dimensioned array), one per dimension with each representing variation in that dimension. An examples illustrates much better than a verbal description: :: @@ -75,41 +84,41 @@ This is particularly useful for evaluating functions of multiple dimensions on a regular grid. -Reading arrays from disk +Reading Arrays From Disk ======================== This is presumably the most common case of large array creation. The details, of course, depend greatly on the format of data on disk and so this section can only give general pointers on how to handle various formats. -Standard binary formats +Standard Binary Formats ----------------------- Various fields have standard formats for array data. The following lists the ones with known python libraries to read them and return numpy arrays (there may be others for which it is possible to read and convert to numpy arrays so check the last section as well) +:: -HDF5: PyTables -FITS: PyFITS -Others? xxx + HDF5: PyTables + FITS: PyFITS + Others? xxx Examples of formats that cannot be read directly but for which it is not hard to convert are libraries like PIL (able to read and write many image formats such as jpg, png, etc). -Common ascii formats --------------------- +Common ASCII Formats +------------------------ Comma Separated Value files (CSV) are widely used (and an export and import option for programs like Excel). There are a number of ways of reading these -files in Python. The most convenient ways of reading these are found in pylab -(part of matplotlib) in the xxx function. (list alternatives xxx) +files in Python. There are CSV functions in Python and functions in pylab +(part of matplotlib). -More generic ascii files can be read using the io package in scipy. xxx a few -more details needed... +More generic ascii files can be read using the io package in scipy. -Custom binary formats +Custom Binary Formats --------------------- There are a variety of approaches one can use. If the file has a relatively @@ -120,13 +129,13 @@ xxx) though that certainly is much more work and requires significantly more advanced knowledge to interface with C or C++. -Use of special libraries +Use of Special Libraries ------------------------ There are libraries that can be used to generate arrays for special purposes and it isn't possible to enumerate all of them. The most common uses are use of the many array generation functions in random that can generate arrays of random values, and some utility functions to generate special matrices (e.g. -diagonal, see xxx) +diagonal) """ Modified: trunk/numpy/doc/glossary.py =================================================================== --- trunk/numpy/doc/glossary.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/doc/glossary.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -1,7 +1,7 @@ """ -================= +======== Glossary -================= +======== along an axis Axes are defined for arrays with more than one dimension. A @@ -23,7 +23,7 @@ >>> x.sum(axis=1) array([ 6, 22, 38]) -array or ndarray +array A homogeneous container of numerical elements. Each element in the array occupies a fixed amount of memory (hence homogeneous), and can be a numerical element of a single type (such as float, int @@ -60,6 +60,9 @@ >>> x.shape (3,) +BLAS + `Basic Linear Algebra Subprograms `_ + broadcast NumPy can do operations on arrays whose shapes are mismatched:: @@ -79,6 +82,24 @@ See `doc.broadcasting`_ for more information. +C order + See `row-major` + +column-major + A way to represent items in a N-dimensional array in the 1-dimensional + computer memory. In column-major order, the leftmost index "varies the + fastest": for example the array:: + + [[1, 2, 3], + [4, 5, 6]] + + is represented in the column-major order as:: + + [1, 4, 2, 5, 3, 6] + + Column-major order is also known as the Fortran order, as the Fortran + programming language uses it. + decorator An operator that transforms a function. For example, a ``log`` decorator may be defined to print debugging information upon @@ -128,6 +149,12 @@ For more information on dictionaries, read the `Python tutorial `_. +Fortran order + See `column-major` + +flattened + Collapsed to a one-dimensional array. See `ndarray.flatten`_ for details. + immutable An object that cannot be modified after execution is called immutable. Two common examples are strings and tuples. @@ -250,10 +277,28 @@ >>> x.repeat(2) array([1, 1, 2, 2, 3, 3]) +ndarray + See *array*. + reference If ``a`` is a reference to ``b``, then ``(a is b) == True``. Therefore, ``a`` and ``b`` are different names for the same Python object. +row-major + A way to represent items in a N-dimensional array in the 1-dimensional + computer memory. In row-major order, the rightmost index "varies + the fastest": for example the array:: + + [[1, 2, 3], + [4, 5, 6]] + + is represented in the row-major order as:: + + [1, 2, 3, 4, 5, 6] + + Row-major order is also known as the C order, as the C programming + language uses it. New Numpy arrays are by default in row-major order. + self Often seen in method signatures, ``self`` refers to the instance of the associated class. For example: Modified: trunk/numpy/doc/misc.py =================================================================== --- trunk/numpy/doc/misc.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/doc/misc.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -1,9 +1,223 @@ """ - ============= Miscellaneous ============= -Placeholder for other tips. +IEEE 754 Floating Point Special Values: +----------------------------------------------- +Special values defined in numpy: nan, inf, + +NaNs can be used as a poor-man's mask (if you don't care what the +original value was) + +Note: cannot use equality to test NaNs. E.g.: :: + + >>> np.where(myarr == np.nan) + >>> nan == nan # is always False! Use special numpy functions instead. + + >>> np.nan == np.nan + False + >>> myarr = np.array([1., 0., np.nan, 3.]) + >>> myarr[myarr == np.nan] = 0. # doesn't work + >>> myarr + array([ 1., 0., NaN, 3.]) + >>> myarr[np.isnan(myarr)] = 0. # use this instead find + >>> myarr + array([ 1., 0., 0., 3.]) + +Other related special value functions: :: + + isinf(): True if value is inf + isfinite(): True if not nan or inf + nan_to_num(): Map nan to 0, inf to max float, -inf to min float + +The following corresponds to the usual functions except that nans are excluded from +the results: :: + + nansum() + nanmax() + nanmin() + nanargmax() + nanargmin() + + >>> x = np.arange(10.) + >>> x[3] = np.nan + >>> x.sum() + nan + >>> np.nansum(x) + 42.0 + +How numpy handles numerical exceptions + +Default is to "warn" +But this can be changed, and it can be set individually for different kinds +of exceptions. The different behaviors are: :: + + 'ignore' : ignore completely + 'warn' : print a warning (once only) + 'raise' : raise an exception + 'call' : call a user-supplied function (set using seterrcall()) + +These behaviors can be set for all kinds of errors or specific ones: :: + + all: apply to all numeric exceptions + invalid: when NaNs are generated + divide: divide by zero (for integers as well!) + overflow: floating point overflows + underflow: floating point underflows + +Note that integer divide-by-zero is handled by the same machinery. +These behaviors are set on a per-thead basis. + +Examples: +------------ + +:: + + >>> oldsettings = np.seterr(all='warn') + >>> np.zeros(5,dtype=np.float32)/0. + invalid value encountered in divide + >>> j = np.seterr(under='ignore') + >>> np.array([1.e-100])**10 + >>> j = np.seterr(invalid='raise') + >>> np.sqrt(np.array([-1.])) + FloatingPointError: invalid value encountered in sqrt + >>> def errorhandler(errstr, errflag): + ... print "saw stupid error!" + >>> np.seterrcall(errorhandler) + >>> j = np.seterr(all='call') + >>> np.zeros(5, dtype=np.int32)/0 + FloatingPointError: invalid value encountered in divide + saw stupid error! + >>> j = np.seterr(**oldsettings) # restore previous + # error-handling settings + +Interfacing to C: +----------------- +Only a survey the choices. Little detail on how each works. + +1) Bare metal, wrap your own C-code manually. + + - Plusses: + + - Efficient + - No dependencies on other tools + + - Minuses: + + - Lots of learning overhead: + + - need to learn basics of Python C API + - need to learn basics of numpy C API + - need to learn how to handle reference counting and love it. + + - Reference counting often difficult to get right. + + - getting it wrong leads to memory leaks, and worse, segfaults + + - API will change for Python 3.0! + +2) pyrex + + - Plusses: + + - avoid learning C API's + - no dealing with reference counting + - can code in psuedo python and generate C code + - can also interface to existing C code + - should shield you from changes to Python C api + - become pretty popular within Python community + + - Minuses: + + - Can write code in non-standard form which may become obsolete + - Not as flexible as manual wrapping + - Maintainers not easily adaptable to new features + +Thus: + +3) cython - fork of pyrex to allow needed features for SAGE + + - being considered as the standard scipy/numpy wrapping tool + - fast indexing support for arrays + +4) ctypes + + - Plusses: + + - part of Python standard library + - good for interfacing to existing sharable libraries, particularly + Windows DLLs + - avoids API/reference counting issues + - good numpy support: arrays have all these in their ctypes + attribute: :: + + a.ctypes.data a.ctypes.get_strides + a.ctypes.data_as a.ctypes.shape + a.ctypes.get_as_parameter a.ctypes.shape_as + a.ctypes.get_data a.ctypes.strides + a.ctypes.get_shape a.ctypes.strides_as + + - Minuses: + + - can't use for writing code to be turned into C extensions, only a wrapper tool. + +5) SWIG (automatic wrapper generator) + + - Plusses: + + - around a long time + - multiple scripting language support + - C++ support + - Good for wrapping large (many functions) existing C libraries + + - Minuses: + + - generates lots of code between Python and the C code + + - can cause performance problems that are nearly impossible to optimize out + + - interface files can be hard to write + - doesn't necessarily avoid reference counting issues or needing to know API's + +7) Weave + + - Plusses: + + - Phenomenal tool + - can turn many numpy expressions into C code + - dynamic compiling and loading of generated C code + - can embed pure C code in Python module and have weave extract, generate interfaces + and compile, etc. + + - Minuses: + + - Future uncertain--lacks a champion + +8) Psyco + + - Plusses: + + - Turns pure python into efficient machine code through jit-like optimizations + - very fast when it optimizes well + + - Minuses: + + - Only on intel (windows?) + - Doesn't do much for numpy? + +Interfacing to Fortran: +----------------------- +Fortran: Clear choice is f2py. (Pyfort is an older alternative, but not supported +any longer) + +Interfacing to C++: +------------------- +1) CXX +2) Boost.python +3) SWIG +4) Sage has used cython to wrap C++ (not pretty, but it can be done) +5) SIP (used mainly in PyQT) + """ Modified: trunk/numpy/doc/subclassing.py =================================================================== --- trunk/numpy/doc/subclassing.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/doc/subclassing.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -20,17 +20,17 @@ ndarrays and object creation ============================ The creation of ndarrays is complicated by the need to return views of -ndarrays, that are also ndarrays. For example:: +ndarrays, that are also ndarrays. For example: - >>> import numpy as np - >>> arr = np.zeros((3,)) - >>> type(arr) - - >>> v = arr[1:] - >>> type(v) - - >>> v is arr - False +>>> import numpy as np +>>> arr = np.zeros((3,)) +>>> type(arr) + +>>> v = arr[1:] +>>> type(v) + +>>> v is arr +False So, when we take a view (here a slice) from the ndarray, we return a new ndarray, that points to the data in the original. When we @@ -148,6 +148,7 @@ ----------------------------------------------------- :: + import numpy as np class InfoArray(np.ndarray): Modified: trunk/numpy/fft/fftpack.py =================================================================== --- trunk/numpy/fft/fftpack.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/fft/fftpack.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -109,24 +109,27 @@ def ifft(a, n=None, axis=-1): """ - Compute the one-dimensonal inverse fft on a given axis. + Compute the one-dimensonal inverse fft along an axis. - Return the n point inverse discrete Fourier transform of a. n - defaults to the length of a. If n is larger than the length of a, - then a will be zero-padded to make up the difference. If n is - smaller than the length of a, then a will be truncated to reduce - its size. + Return the `n` point inverse discrete Fourier transform of `a`. The length + `n` defaults to the length of `a`. If `n` is larger than the length of `a`, + then `a` will be zero-padded to make up the difference. If `n` is smaller + than the length of `a`, then `a` will be truncated to reduce its size. Parameters ---------- - a : array - input array - n : int - length of the fft - axis : int - axis over which to compute the inverse fft + a : array_like + Input array. + n : int, optional + Length of the fft. + axis : int, optional + Axis over which to compute the inverse fft. + See Also + -------- + fft + Notes ----- The input array is expected to be packed the same way as the output of @@ -135,10 +138,10 @@ This is the inverse of fft: ifft(fft(a)) == a within numerical accuracy. - This is most efficient for n a power of two. This also stores a cache of + This is most efficient for `n` a power of two. This also stores a cache of working memory for different sizes of fft's, so you could theoretically run into memory problems if you call this too many times with too many - different n's. + different `n` values. """ @@ -189,35 +192,36 @@ """ Compute the one-dimensional inverse fft for real input. - Notes - ----- - - Return the real valued n point inverse discrete Fourier transform - of a, where a contains the nonnegative frequency terms of a - Hermite-symmetric sequence. n is the length of the result, not the - input. If n is not supplied, the default is 2*(len(a)-1). If you - want the length of the result to be odd, you have to say so. - Parameters ---------- - a : array - input array with real data type + Input array with real data type. n : int - length of the fft + Length of the fft. axis : int - axis over which to compute the fft + Axis over which to compute the fft. + See Also + -------- + rfft + Notes ----- + Return the real valued `n` point inverse discrete Fourier transform + of `a`, where `a` contains the nonnegative frequency terms of a + Hermite-symmetric sequence. `n` is the length of the result, not the + input. If `n` is not supplied, the default is 2*(len(`a`)-1). If you + want the length of the result to be odd, you have to say so. - If you specify an n such that a must be zero-padded or truncated, the + If you specify an `n` such that `a` must be zero-padded or truncated, the extra/removed values will be added/removed at high frequencies. One can thus resample a series to m points via Fourier interpolation by: a_resamp = irfft(rfft(a), m). - This is the inverse of rfft: irfft(rfft(a), len(a)) == a within numerical accuracy. + Within numerical accuracy ``irfft`` is the inverse of ``rfft``:: + irfft(rfft(a), len(a)) == a + """ a = asarray(a).astype(complex) @@ -240,6 +244,11 @@ axis : int axis over which to compute the hfft + See also + -------- + rfft + ihfft + Notes ----- These are a pair analogous to rfft/irfft, but for the @@ -250,11 +259,6 @@ ihfft(hfft(a), len(a)) == a within numerical accuracy. - See also - -------- - rfft - ihfft - """ a = asarray(a).astype(complex) @@ -265,18 +269,21 @@ def ihfft(a, n=None, axis=-1): """ - Compute the inverse fft of a signal which spectrum has Hermitian - symmetry. + Compute the inverse fft of a signal whose spectrum has Hermitian symmetry. Parameters ---------- - a : array - input array - n : int - length of the ihfft - axis : int - axis over which to compute the ihfft + a : array_like + Input array. + n : int, optional + Length of the ihfft. + axis : int, optional + Axis over which to compute the ihfft. + See also + -------- + rfft, hfft + Notes ----- These are a pair analogous to rfft/irfft, but for the @@ -287,11 +294,6 @@ ihfft(hfft(a), len(a)) == a within numerical accuracy. - See also - -------- - rfft - hfft - """ a = asarray(a).astype(float) @@ -395,20 +397,21 @@ def fft2(a, s=None, axes=(-2,-1)): """ - Compute the 2d fft of an array. + Compute the 2-D FFT of an array. Parameters ---------- - a : array - input array - s : sequence (int) - shape of the fft - axis : int - axis over which to compute the fft + a : array_like + Input array. The rank (dimensions) of `a` must be 2 or greater. + s : shape tuple + Shape of the FFT. + axes : sequence of 2 ints + The 2 axes over which to compute the FFT. The default is the last two + axes (-2, -1). Notes ----- - This is really just fftn with different default behavior. + This is really just ``fftn`` with different default behavior. """ Modified: trunk/numpy/fft/helper.py =================================================================== --- trunk/numpy/fft/helper.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/fft/helper.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -10,14 +10,23 @@ import types def fftshift(x,axes=None): - """ fftshift(x, axes=None) -> y - + """ Shift zero-frequency component to center of spectrum. This function swaps half-spaces for all axes listed (defaults to all). + If len(x) is even then the Nyquist component is y[0]. - Notes: - If len(x) is even then the Nyquist component is y[0]. + Parameters + ---------- + x : array_like + Input array. + axes : int or shape tuple, optional + Axes over which to shift. Default is None which shifts all axes. + + See Also + -------- + ifftshift + """ tmp = asarray(x) ndim = len(tmp.shape) @@ -33,9 +42,20 @@ def ifftshift(x,axes=None): - """ ifftshift(x,axes=None) - > y + """ + Inverse of fftshift. - Inverse of fftshift. + Parameters + ---------- + x : array_like + Input array. + axes : int or shape tuple, optional + Axes over which to calculate. Defaults to None which is over all axes. + + See Also + -------- + fftshift + """ tmp = asarray(x) ndim = len(tmp.shape) @@ -50,16 +70,39 @@ return y def fftfreq(n,d=1.0): - """ fftfreq(n, d=1.0) -> f + """ + Discrete Fourier Transform sample frequencies. - DFT sample frequencies - The returned float array contains the frequency bins in - cycles/unit (with zero at the start) given a window length n and a - sample spacing d: + cycles/unit (with zero at the start) given a window length `n` and a + sample spacing `d`. + :: f = [0,1,...,n/2-1,-n/2,...,-1]/(d*n) if n is even f = [0,1,...,(n-1)/2,-(n-1)/2,...,-1]/(d*n) if n is odd + + Parameters + ---------- + n : int + Window length. + d : scalar + Sample spacing. + + Returns + ------- + out : ndarray, shape(`n`,) + Sample frequencies. + + Examples + -------- + >>> signal = np.array([-2., 8., -6., 4., 1., 0., 3., 5.]) + >>> fourier = np.fft.fft(signal) + >>> n = len(signal) + >>> timestep = 0.1 + >>> freq = np.fft.fftfreq(n, d=timestep) + >>> freq + array([ 0. , 1.25, 2.5 , 3.75, -5. , -3.75, -2.5 , -1.25]) + """ assert isinstance(n,types.IntType) or isinstance(n, integer) val = 1.0/(n*d) Modified: trunk/numpy/lib/__init__.py =================================================================== --- trunk/numpy/lib/__init__.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/__init__.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -1,3 +1,151 @@ +""" +Basic functions used by several sub-packages and +useful to have in the main name-space. + +Type Handling +------------- +================ =================== +iscomplexobj Test for complex object, scalar result +isrealobj Test for real object, scalar result +iscomplex Test for complex elements, array result +isreal Test for real elements, array result +imag Imaginary part +real Real part +real_if_close Turns complex number with tiny imaginary part to real +isneginf Tests for negative infinity, array result +isposinf Tests for positive infinity, array result +isnan Tests for nans, array result +isinf Tests for infinity, array result +isfinite Tests for finite numbers, array result +isscalar True if argument is a scalar +nan_to_num Replaces NaN's with 0 and infinities with large numbers +cast Dictionary of functions to force cast to each type +common_type Determine the minimum common type code for a group + of arrays +mintypecode Return minimal allowed common typecode. +================ =================== + +Index Tricks +------------ +================ =================== +mgrid Method which allows easy construction of N-d + 'mesh-grids' +``r_`` Append and construct arrays: turns slice objects into + ranges and concatenates them, for 2d arrays appends rows. +index_exp Konrad Hinsen's index_expression class instance which + can be useful for building complicated slicing syntax. +================ =================== + +Useful Functions +---------------- +================ =================== +select Extension of where to multiple conditions and choices +extract Extract 1d array from flattened array according to mask +insert Insert 1d array of values into Nd array according to mask +linspace Evenly spaced samples in linear space +logspace Evenly spaced samples in logarithmic space +fix Round x to nearest integer towards zero +mod Modulo mod(x,y) = x % y except keeps sign of y +amax Array maximum along axis +amin Array minimum along axis +ptp Array max-min along axis +cumsum Cumulative sum along axis +prod Product of elements along axis +cumprod Cumluative product along axis +diff Discrete differences along axis +angle Returns angle of complex argument +unwrap Unwrap phase along given axis (1-d algorithm) +sort_complex Sort a complex-array (based on real, then imaginary) +trim_zeros Trim the leading and trailing zeros from 1D array. +vectorize A class that wraps a Python function taking scalar + arguments into a generalized function which can handle + arrays of arguments using the broadcast rules of + numerix Python. +================ =================== + +Shape Manipulation +------------------ +================ =================== +squeeze Return a with length-one dimensions removed. +atleast_1d Force arrays to be > 1D +atleast_2d Force arrays to be > 2D +atleast_3d Force arrays to be > 3D +vstack Stack arrays vertically (row on row) +hstack Stack arrays horizontally (column on column) +column_stack Stack 1D arrays as columns into 2D array +dstack Stack arrays depthwise (along third dimension) +split Divide array into a list of sub-arrays +hsplit Split into columns +vsplit Split into rows +dsplit Split along third dimension +================ =================== + +Matrix (2D Array) Manipulations +------------------------------- +================ =================== +fliplr 2D array with columns flipped +flipud 2D array with rows flipped +rot90 Rotate a 2D array a multiple of 90 degrees +eye Return a 2D array with ones down a given diagonal +diag Construct a 2D array from a vector, or return a given + diagonal from a 2D array. +mat Construct a Matrix +bmat Build a Matrix from blocks +================ =================== + +Polynomials +----------- +================ =================== +poly1d A one-dimensional polynomial class +poly Return polynomial coefficients from roots +roots Find roots of polynomial given coefficients +polyint Integrate polynomial +polyder Differentiate polynomial +polyadd Add polynomials +polysub Substract polynomials +polymul Multiply polynomials +polydiv Divide polynomials +polyval Evaluate polynomial at given argument +================ =================== + +Import Tricks +------------- +================ =================== +ppimport Postpone module import until trying to use it +ppimport_attr Postpone module import until trying to use its attribute +ppresolve Import postponed module and return it. +================ =================== + +Machine Arithmetics +------------------- +================ =================== +machar_single Single precision floating point arithmetic parameters +machar_double Double precision floating point arithmetic parameters +================ =================== + +Threading Tricks +---------------- +================ =================== +ParallelExec Execute commands in parallel thread. +================ =================== + +1D Array Set Operations +----------------------- +Set operations for 1D numeric arrays based on sort() function. + +================ =================== +ediff1d Array difference (auxiliary function). +unique1d Unique elements of 1D array. +intersect1d Intersection of 1D arrays with unique elements. +intersect1d_nu Intersection of 1D arrays with any elements. +setxor1d Set exclusive-or of 1D arrays with unique elements. +setmember1d Return an array of shape of ar1 containing 1 where + the elements of ar1 are in ar2 and 0 otherwise. +union1d Union of 1D arrays with unique elements. +setdiff1d Set difference of 1D arrays with unique elements. +================ =================== + +""" from info import __doc__ from numpy.version import version as __version__ Modified: trunk/numpy/lib/_datasource.py =================================================================== --- trunk/numpy/lib/_datasource.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/_datasource.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -275,27 +275,29 @@ return None def abspath(self, path): - """Return absolute path of ``path`` in the DataSource directory. + """ + Return absolute path of file in the DataSource directory. - If ``path`` is an URL, the ``abspath`` will be either the location + If `path` is an URL, the ``abspath`` will be either the location the file exists locally or the location it would exist when opened using the ``open`` method. The functionality is idential to os.path.abspath. - *Parameters*: + Parameters + ---------- + path : string + Can be a local file or a remote URL. - path : {string} - Can be a local file or a remote URL. - - *Returns*: - + Returns + ------- + out : string Complete path, rooted in the DataSource destination directory. - *See Also*: + See Also + -------- + open - `open` : Method that downloads and opens files. - """ # We do this here to reduce the 'import numpy' initial import time. from urlparse import urlparse @@ -332,9 +334,10 @@ return path def exists(self, path): - """Test if ``path`` exists. + """ + Test if path exists. - Test if ``path`` exists as (and in this order): + Test if `path` exists as (and in this order): - a local file. - a remote URL that have been downloaded and stored locally in the @@ -342,26 +345,27 @@ - a remote URL that has not been downloaded, but is valid and accessible. - *Parameters*: + Parameters + ---------- + path : string + Can be a local file or a remote URL. - path : {string} - Can be a local file or a remote URL. + Returns + ------- + out : bool + True if `path` exists. - *Returns*: + See Also + -------- + abspath - boolean + Notes + ----- + When `path` is an URL, ``exist`` will return True if it's either stored + locally in the DataSource directory, or is a valid remote URL. DataSource + does not discriminate between to two, the file is accessible if it exists + in either location. - *See Also*: - - `abspath` - - *Notes* - - When ``path`` is an URL, ``exist`` will return True if it's either - stored locally in the DataSource directory, or is a valid remote - URL. DataSource does not discriminate between to two, the file - is accessible if it exists in either location. - """ # We import this here because importing urllib2 is slow and # a significant fraction of numpy's total import time. @@ -387,22 +391,26 @@ return False def open(self, path, mode='r'): - """Open ``path`` with ``mode`` and return the file object. + """ + Open and return file-like object. If ``path`` is an URL, it will be downloaded, stored in the DataSource directory and opened from there. - *Parameters*: + Parameters + ---------- + path : string + Local file path or URL to open + mode : {'r', 'w', 'a'}, optional + Mode to open `path`. Mode 'r' for reading, 'w' for writing, 'a' to + append. Available modes depend on the type of object specified by + `path`. - path : {string} + Returns + ------- + out : file object + File object. - mode : {string}, optional - - - *Returns*: - - file object - """ # TODO: There is no support for opening a file for writing which @@ -476,19 +484,106 @@ return DataSource._findfile(self, self._fullpath(path)) def abspath(self, path): - """Extend DataSource method to prepend baseurl to ``path``.""" + """ + Return absolute path of file in the Repository directory. + + If `path` is an URL, the ``abspath`` will be either the location + the file exists locally or the location it would exist when opened + using the ``open`` method. + + The functionality is idential to os.path.abspath. + + Parameters + ---------- + path : string + Can be a local file or a remote URL. + + Returns + ------- + out : string + Complete path, rooted in the DataSource destination directory. + + See Also + -------- + open + + """ return DataSource.abspath(self, self._fullpath(path)) def exists(self, path): - """Extend DataSource method to prepend baseurl to ``path``.""" + """ + Test if path exists prepending Repository base URL to path. + + Test if `path` exists as (and in this order): + + - a local file. + - a remote URL that have been downloaded and stored locally in the + DataSource directory. + - a remote URL that has not been downloaded, but is valid and + accessible. + + Parameters + ---------- + path : string + Can be a local file or a remote URL. + + Returns + ------- + out : bool + True if `path` exists. + + See Also + -------- + abspath + + Notes + ----- + When `path` is an URL, ``exist`` will return True if it's either stored + locally in the DataSource directory, or is a valid remote URL. DataSource + does not discriminate between to two, the file is accessible if it exists + in either location. + + """ return DataSource.exists(self, self._fullpath(path)) def open(self, path, mode='r'): - """Extend DataSource method to prepend baseurl to ``path``.""" + """ + Open and return file-like object prepending Repository base URL. + + If `path` is an URL, it will be downloaded, stored in the DataSource + directory and opened from there. + + Parameters + ---------- + path : string + Local file path or URL to open + mode : {'r', 'w', 'a'}, optional + Mode to open `path`. Mode 'r' for reading, 'w' for writing, 'a' to + append. Available modes depend on the type of object specified by + `path`. + + Returns + ------- + out : file object + File object. + + """ return DataSource.open(self, self._fullpath(path), mode) def listdir(self): - '''List files in the source Repository.''' + """ + List files in the source Repository. + + Returns + ------- + files : list of str + List of file names (not containing a directory part). + + Notes + ----- + Does not currently work for remote repositories. + + """ if self._isurl(self._baseurl): raise NotImplementedError, \ "Directory listing of URLs, not supported yet." Modified: trunk/numpy/lib/arraysetops.py =================================================================== --- trunk/numpy/lib/arraysetops.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/arraysetops.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -79,7 +79,7 @@ Parameters ---------- - ar1 : array-like + ar1 : array_like This array will be flattened if it is not already 1-D. return_index : bool, optional If True, also return the indices against `ar1` that result in the @@ -101,8 +101,8 @@ See Also -------- - numpy.lib.arraysetops : Module with a number of other functions - for performing set operations on arrays. + numpy.lib.arraysetops : Module with a number of other functions + for performing set operations on arrays. Examples -------- @@ -230,14 +230,14 @@ Parameters ---------- - ar1 : array + ar1 : array_like Input array. - ar2 : array + ar2 : array_like Input array. Returns ------- - xor : array + xor : ndarray The values that are only in one, but not both, of the input arrays. See Also @@ -269,15 +269,15 @@ Parameters ---------- - ar1 : array + ar1 : array_like Input array. - ar2 : array + ar2 : array_like Input array. Returns ------- - mask : bool-array - The values ar1[mask] are in ar2. + mask : ndarray, bool + The values `ar1[mask]` are in `ar2`. See Also -------- @@ -325,7 +325,7 @@ Returns ------- - union : array + union : ndarray Unique union of input arrays. See also @@ -345,14 +345,14 @@ Parameters ---------- - ar1 : array + ar1 : array_like Input array. - ar2 : array + ar2 : array_like Input comparison array. Returns ------- - difference : array + difference : ndarray The values in ar1 that are not in ar2. See Also Modified: trunk/numpy/lib/financial.py =================================================================== --- trunk/numpy/lib/financial.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/financial.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -30,26 +30,36 @@ Parameters ---------- - rate : array-like - Rate of interest (per period) - nper : array-like + rate : scalar or array_like of shape(M, ) + Rate of interest as decimal (not per cent) per period + nper : scalar or array_like of shape(M, ) Number of compounding periods - pmt : array-like + pmt : scalar or array_like of shape(M, ) Payment - pv : array-like + pv : scalar or array_like of shape(M, ) Present value - when : array-like - When payments are due ('begin' (1) or 'end' (0)) + when : {{'begin', 1}, {'end', 0}}, {string, int}, optional + When payments are due ('begin' (1) or 'end' (0)). + Defaults to {'end', 0}. + Returns + ------- + out : ndarray + Future values. If all input is scalar, returns a scalar float. If + any input is array_like, returns future values for each input element. + If multiple inputs are array_like, they all must have the same shape. + Notes ----- The future value is computed by solving the equation:: - fv + pv*(1+rate)**nper + pmt*(1+rate*when)/rate * ((1+rate)**nper - 1) == 0 + fv + + pv*(1+rate)**nper + + pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) == 0 or, when ``rate == 0``:: - fv + pv + pmt * nper == 0 + fv + pv + pmt * nper == 0 Examples -------- @@ -64,6 +74,13 @@ available today). Thus, saving $100 a month at 5% annual interest leads to $15,692.93 available to spend in 10 years. + If any input is array_like, returns an array of equal shape. Let's + compare different interest rates from the example above. + + >>> a = np.array((0.05, 0.06, 0.07))/12 + >>> np.fv(a, 10*12, -100, -100) + array([ 15692.92889434, 16569.87435405, 17509.44688102]) + """ when = _convert_when(when) rate, nper, pmt, pv, when = map(np.asarray, [rate, nper, pmt, pv, when]) @@ -75,26 +92,36 @@ def pmt(rate, nper, pv, fv=0, when='end'): """ - Compute the payment. + Compute the payment against loan principal plus interest. Parameters ---------- - rate : array-like + rate : array_like Rate of interest (per period) - nper : array-like + nper : array_like Number of compounding periods - pv : array-like + pv : array_like Present value - fv : array-like + fv : array_like Future value - when : array-like + when : {{'begin', 1}, {'end', 0}}, {string, int} When payments are due ('begin' (1) or 'end' (0)) + Returns + ------- + out : ndarray + Payment against loan plus interest. If all input is scalar, returns a + scalar float. If any input is array_like, returns payment for each + input element. If multiple inputs are array_like, they all must have + the same shape. + Notes ----- The payment ``pmt`` is computed by solving the equation:: - fv + pv*(1+rate)**nper + pmt*(1+rate*when)/rate * ((1+rate)**nper - 1) == 0 + fv + + pv*(1 + rate)**nper + + pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) == 0 or, when ``rate == 0``:: @@ -132,9 +159,9 @@ Payment pv : array_like Present value - fv : array_like + fv : array_like, optional Future value - when : array_like + when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0)) Notes @@ -157,8 +184,8 @@ So, over 64 months would be required to pay off the loan. - The same analysis could be done with several different interest rates and/or - payments and/or total amounts to produce an entire table. + The same analysis could be done with several different interest rates + and/or payments and/or total amounts to produce an entire table. >>> np.nper(*(np.ogrid[0.06/12:0.071/12:0.01/12, -200:-99:100, 6000:7001:1000])) array([[[ 32.58497782, 38.57048452], @@ -182,14 +209,73 @@ def ipmt(rate, per, nper, pv, fv=0.0, when='end'): """ - Not implemented. + Not implemented. Compute the payment portion for loan interest. + Parameters + ---------- + rate : scalar or array_like of shape(M, ) + Rate of interest as decimal (not per cent) per period + per : scalar or array_like of shape(M, ) + Interest paid against the loan changes during the life or the loan. + The `per` is the payment period to calculate the interest amount. + nper : scalar or array_like of shape(M, ) + Number of compounding periods + pv : scalar or array_like of shape(M, ) + Present value + fv : scalar or array_like of shape(M, ), optional + Future value + when : {{'begin', 1}, {'end', 0}}, {string, int}, optional + When payments are due ('begin' (1) or 'end' (0)). + Defaults to {'end', 0}. + + Returns + ------- + out : ndarray + Interest portion of payment. If all input is scalar, returns a scalar + float. If any input is array_like, returns interest payment for each + input element. If multiple inputs are array_like, they all must have + the same shape. + + See Also + -------- + ppmt, pmt, pv + + Notes + ----- + The total payment is made up of payment against principal plus interest. + + ``pmt = ppmt + ipmt`` + """ total = pmt(rate, nper, pv, fv, when) # Now, compute the nth step in the amortization raise NotImplementedError def ppmt(rate, per, nper, pv, fv=0.0, when='end'): + """ + Not implemented. Compute the payment against loan principal. + + Parameters + ---------- + rate : array_like + Rate of interest (per period) + per : array_like, int + Amount paid against the loan changes. The `per` is the period of + interest. + nper : array_like + Number of compounding periods + pv : array_like + Present value + fv : array_like, optional + Future value + when : {{'begin', 1}, {'end', 0}}, {string, int} + When payments are due ('begin' (1) or 'end' (0)) + + See Also + -------- + pmt, pv, ipmt + + """ total = pmt(rate, nper, pv, fv, when) return total - ipmt(rate, per, nper, pv, fv, when) @@ -199,22 +285,29 @@ Parameters ---------- - rate : array-like + rate : array_like Rate of interest (per period) - nper : array-like + nper : array_like Number of compounding periods - pmt : array-like + pmt : array_like Payment - fv : array-like + fv : array_like, optional Future value - when : array-like + when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0)) + Returns + ------- + out : ndarray, float + Present value of a series of payments or investments. + Notes ----- The present value ``pv`` is computed by solving the equation:: - fv + pv*(1+rate)**nper + pmt*(1+rate*when)/rate * ((1+rate)**nper - 1) = 0 + fv + + pv*(1 + rate)**nper + + pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) = 0 or, when ``rate = 0``:: @@ -258,7 +351,7 @@ Present value fv : array_like Future value - when : array_like, optional + when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0)) guess : float, optional Starting guess for solving the rate of interest @@ -296,11 +389,27 @@ return rn def irr(values): - """Internal Rate of Return + """ + Return the Internal Rate of Return (IRR). - This is the rate of return that gives a net present value of 0.0 + This is the rate of return that gives a net present value of 0.0. - npv(irr(values), values) == 0.0 + Parameters + ---------- + values : array_like, shape(N,) + Input cash flows per time period. At least the first value would be + negative to represent the investment in the project. + + Returns + ------- + out : float + Internal Rate of Return for periodic input values. + + Examples + -------- + >>> np.irr([-100, 39, 59, 55, 20]) + 0.2809484211599611 + """ res = np.roots(values[::-1]) # Find the root(s) between 0 and 1 @@ -314,25 +423,51 @@ return rate def npv(rate, values): - """Net Present Value + """ + Returns the NPV (Net Present Value) of a cash flow series. - sum ( values_k / (1+rate)**k, k = 1..n) + Parameters + ---------- + rate : scalar + The discount rate. + values : array_like, shape(M, ) + The values of the time series of cash flows. Must be the same + increment as the `rate`. + + Returns + ------- + out : float + The NPV of the input cash flow series `values` at the discount `rate`. + + Notes + ----- + Returns the result of: + + .. math :: \\sum_{t=1}^M{\\frac{values_t}{(1+rate)^{t}}} + """ values = np.asarray(values) return (values / (1+rate)**np.arange(1,len(values)+1)).sum(axis=0) def mirr(values, finance_rate, reinvest_rate): - """Modified internal rate of return + """ + Modified internal rate of return. Parameters ---------- - values: + values : array_like Cash flows (must contain at least one positive and one negative value) or nan is returned. - finance_rate : + finance_rate : scalar Interest rate paid on the cash flows - reinvest_rate : + reinvest_rate : scalar Interest rate received on the cash flows upon reinvestment + + Returns + ------- + out : float + Modified internal rate of return + """ values = np.asarray(values) Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/function_base.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -34,34 +34,35 @@ def linspace(start, stop, num=50, endpoint=True, retstep=False): """ - Return evenly spaced numbers. + Return evenly spaced numbers over a specified interval. - `linspace` returns `num` evenly spaced samples, calculated over the - interval ``[start, stop]``. The endpoint of the interval can optionally - be excluded. + Returns `num` evenly spaced samples, calculated over the + interval [`start`, `stop` ]. + The endpoint of the interval can optionally be excluded. + Parameters ---------- - start : float + start : {float, int} The starting value of the sequence. - stop : float + stop : {float, int} The end value of the sequence, unless `endpoint` is set to False. In that case, the sequence consists of all but the last of ``num + 1`` evenly spaced samples, so that `stop` is excluded. Note that the step size changes when `endpoint` is False. - num : int + num : int, optional Number of samples to generate. Default is 50. - endpoint : bool - If true, `stop` is the last sample. Otherwise, it is not included. + endpoint : bool, optional + If True, `stop` is the last sample. Otherwise, it is not included. Default is True. - retstep : bool + retstep : bool, optional If True, return (`samples`, `step`), where `step` is the spacing between samples. Returns ------- samples : ndarray - `num` equally spaced samples in the closed interval + There are `num` equally spaced samples in the closed interval ``[start, stop]`` or the half-open interval ``[start, stop)`` (depending on whether `endpoint` is True or False). step : float (only if `retstep` is True) @@ -71,8 +72,7 @@ See Also -------- arange : Similiar to `linspace`, but uses a step size (instead of the - number of samples). Note that, when used with a float - endpoint, the endpoint may or may not be included. + number of samples). logspace : Samples uniformly distributed in log space. Examples @@ -409,36 +409,36 @@ Parameters ---------- - sample : array-like - Data to histogram passed as a sequence of D arrays of length N, or - as an (N,D) array. + sample : array_like + Data to histogram passed as a sequence of D arrays of length N, or + as an (N,D) array. bins : sequence or int, optional - The bin specification: + The bin specification: - * A sequence of arrays describing the bin edges along each dimension. - * The number of bins for each dimension (nx, ny, ... =bins) - * The number of bins for all dimensions (nx=ny=...=bins). + * A sequence of arrays describing the bin edges along each dimension. + * The number of bins for each dimension (nx, ny, ... =bins) + * The number of bins for all dimensions (nx=ny=...=bins). range : sequence, optional - A sequence of lower and upper bin edges to be used if the edges are - not given explicitely in `bins`. Defaults to the minimum and maximum - values along each dimension. + A sequence of lower and upper bin edges to be used if the edges are + not given explicitely in `bins`. Defaults to the minimum and maximum + values along each dimension. normed : boolean, optional - If False, returns the number of samples in each bin. If True, returns - the bin density, ie, the bin count divided by the bin hypervolume. - weights : array-like (N,), optional - An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. - Weights are normalized to 1 if normed is True. If normed is False, the - values of the returned histogram are equal to the sum of the weights - belonging to the samples falling into each bin. + If False, returns the number of samples in each bin. If True, returns + the bin density, ie, the bin count divided by the bin hypervolume. + weights : array_like (N,), optional + An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. + Weights are normalized to 1 if normed is True. If normed is False, the + values of the returned histogram are equal to the sum of the weights + belonging to the samples falling into each bin. Returns ------- - H : array - The multidimensional histogram of sample x. See normed and weights for - the different possible semantics. + H : ndarray + The multidimensional histogram of sample x. See normed and weights for + the different possible semantics. edges : list - A list of D arrays describing the bin edges for each dimension. + A list of D arrays describing the bin edges for each dimension. See Also -------- @@ -572,25 +572,24 @@ """ Return the weighted average of array over the specified axis. - Parameters ---------- a : array_like Data to be averaged. - axis : {None, integer}, optional + axis : int, optional Axis along which to average `a`. If `None`, averaging is done over the entire array irrespective of its shape. - weights : {None, array_like}, optional + weights : array_like, optional The importance that each datum has in the computation of the average. - The weights array can either be 1D (in which case its length must be + The weights array can either be 1-D (in which case its length must be the size of `a` along the given axis) or of the same shape as `a`. If `weights=None`, then all data in `a` are assumed to have a weight equal to one. - returned : {False, boolean}, optional - If `True`, the tuple (`average`, `sum_of_weights`) is returned, - otherwise only the average is returned. Note that if `weights=None`, - `sum_of_weights` is equivalent to the number of elements over which - the average is taken. + returned : bool, optional + Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) + is returned, otherwise only the average is returned. Note that + if `weights=None`, `sum_of_weights` is equivalent to the number of + elements over which the average is taken. Returns ------- @@ -660,8 +659,65 @@ return avg def asarray_chkfinite(a): - """Like asarray, but check that no NaNs or Infs are present. """ + Convert the input to an array, checking for NaNs or Infs. + + Parameters + ---------- + a : array_like + Input data, in any form that can be converted to an array. This + includes lists, lists of tuples, tuples, tuples of tuples, tuples + of lists and ndarrays. Success requires no NaNs or Infs. + dtype : data-type, optional + By default, the data-type is inferred from the input data. + order : {'C', 'F'}, optional + Whether to use row-major ('C') or column-major ('FORTRAN') memory + representation. Defaults to 'C'. + + Returns + ------- + out : ndarray + Array interpretation of `a`. No copy is performed if the input + is already an ndarray. If `a` is a subclass of ndarray, a base + class ndarray is returned. + + Raises + ------ + ValueError + Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). + + See Also + -------- + asarray : Create and array. + asanyarray : Similar function which passes through subclasses. + ascontiguousarray : Convert input to a contiguous array. + asfarray : Convert input to a floating point ndarray. + asfortranarray : Convert input to an ndarray with column-major + memory order. + fromiter : Create an array from an iterator. + fromfunction : Construct an array by executing a function on grid + positions. + + Examples + -------- + Convert a list into an array. If all elements are finite + ``asarray_chkfinite`` is identical to ``asarray``. + + >>> a = [1, 2] + >>> np.asarray_chkfinite(a) + array([1, 2]) + + Raises ValueError if array_like contains Nans or Infs. + + >>> a = [1, 2, np.inf] + >>> try: + ... np.asarray_chkfinite(a) + ... except ValueError: + ... print 'ValueError' + ... + ValueError + + """ a = asarray(a) if (a.dtype.char in typecodes['AllFloat']) \ and (_nx.isnan(a).any() or _nx.isinf(a).any()): @@ -821,6 +877,15 @@ output += [V[m] for V,C in zip(values,cond) if C[m]] or [default] + Examples + -------- + >>> t = np.arange(10) + >>> s = np.arange(10)*100 + >>> condlist = [t == 4, t > 5] + >>> choicelist = [s, t] + >>> np.select(condlist, choicelist) + array([ 0, 0, 0, 0, 400, 0, 6, 7, 8, 9]) + """ n = len(condlist) n2 = len(choicelist) @@ -1155,14 +1220,18 @@ z : array_like A complex number or sequence of complex numbers. deg : bool, optional - Return angle in degrees if True, radians if False. Default is False. + Return angle in degrees if True, radians if False (default). Returns ------- angle : {ndarray, scalar} - The angle is defined as counterclockwise from the positive real axis on + The counterclockwise angle from the positive real axis on the complex plane, with dtype as numpy.float64. + See Also + -------- + arctan2 + Examples -------- >>> np.angle([1.0, 1.0j, 1+1j]) # in radians @@ -1233,6 +1302,13 @@ out : complex ndarray Always returns a sorted complex array. + Examples + -------- + >>> np.sort_complex([5, 3, 6, 2, 1]) + array([ 1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) + >>> np.sort_complex([5 + 2j, 3 - 1j, 6 - 2j, 2 - 3j, 1 - 5j]) + array([ 1.-5.j, 2.-3.j, 3.-1.j, 5.+2.j, 6.-2.j]) + """ b = array(a,copy=True) b.sort() @@ -1360,10 +1436,28 @@ return _nx.take(ravel(arr), nonzero(ravel(condition))[0]) def place(arr, mask, vals): - """Similar to putmask arr[mask] = vals but the 1D array vals has the - same number of elements as the non-zero values of mask. Inverse of - extract. + """ + Changes elements of an array based on conditional and input values. + Similar to ``putmask(a, mask, vals)`` but the 1D array `vals` has the + same number of elements as the non-zero values of `mask`. Inverse of + ``extract``. + + Sets `a`.flat[n] = `values`\\[n] for each n where `mask`.flat[n] is true. + + Parameters + ---------- + a : array_like + Array to put data into. + mask : array_like + Boolean mask array. + values : array_like, shape(number of non-zero `mask`, ) + Values to put into `a`. + + See Also + -------- + putmask, put, take + """ return _insert(arr, mask, vals) @@ -1401,47 +1495,112 @@ def nansum(a, axis=None): """ - Sum the array along the given axis, treating NaNs as zero. + Return the sum of array elements over a given axis treating + Not a Numbers (NaNs) as zero. Parameters ---------- - a : array-like - Input array. - axis : {int, None}, optional - Axis along which the sum is computed. By default `a` is flattened. + a : array_like + Array containing numbers whose sum is desired. If `a` is not an + array, a conversion is attempted. + axis : int, optional + Axis along which the sum is computed. The default is to compute + the sum of the flattened array. Returns ------- - y : {ndarray, scalar} - The sum ignoring NaNs. + y : ndarray + An array with the same shape as a, with the specified axis removed. + If a is a 0-d array, or if axis is None, a scalar is returned with + the same dtype as `a`. + See Also + -------- + numpy.sum : Sum across array including Not a Numbers. + isnan : Shows which elements are Not a Number (NaN). + isfinite: Shows which elements are not: Not a Number, positive and + negative infinity + + Notes + ----- + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + If positive or negative infinity are present the result is positive or + negative infinity. But if both positive and negative infinity are present, + the result is Not A Number (NaN). + + Arithmetic is modular when using integer types (all elements of `a` must + be finite i.e. no elements that are NaNs, positive infinity and negative + infinity because NaNs are floating point types), and no error is raised + on overflow. + + Examples -------- - >>> np.nansum([np.nan, 1]) + >>> np.nansum(1) + 1 + >>> np.nansum([1]) + 1 + >>> np.nansum([1, np.nan]) 1.0 >>> a = np.array([[1, 1], [1, np.nan]]) + >>> np.nansum(a) + 3.0 >>> np.nansum(a, axis=0) array([ 2., 1.]) + When positive infinity and negative infinity are present + + >>> np.nansum([1, np.nan, np.inf]) + inf + >>> np.nansum([1, np.nan, np.NINF]) + -inf + >>> np.nansum([1, np.nan, np.inf, np.NINF]) + nan + """ return _nanop(np.sum, 0, a, axis) def nanmin(a, axis=None): """ - Find the minimum along the given axis, ignoring NaNs. + Return the minimum of array elements over the given axis ignoring any NaNs. Parameters ---------- a : array_like - Input array. + Array containing numbers whose sum is desired. If `a` is not + an array, a conversion is attempted. axis : int, optional - Axis along which the minimum is computed. By default `a` is flattened. + Axis along which the minimum is computed.The default is to compute + the minimum of the flattened array. Returns ------- y : {ndarray, scalar} - The minimum ignoring NaNs. + An array with the same shape as `a`, with the specified axis removed. + If `a` is a 0-d array, or if axis is None, a scalar is returned. The + the same dtype as `a` is returned. + + See Also + -------- + numpy.amin : Minimum across array including any Not a Numbers. + numpy.nanmax : Maximum across array ignoring any Not a Numbers. + isnan : Shows which elements are Not a Number (NaN). + isfinite: Shows which elements are not: Not a Number, positive and + negative infinity + + Notes + ----- + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Positive infinity is treated as a very large number and negative infinity + is treated as a very small (i.e. negative) number. + + If the input has a integer type, an integer type is returned unless + the input contains NaNs and infinity. + + Examples -------- >>> a = np.array([[1, 2], [3, np.nan]]) @@ -1452,35 +1611,66 @@ >>> np.nanmin(a, axis=1) array([ 1., 3.]) + When positive infinity and negative infinity are present: + + >>> np.nanmin([1, 2, np.nan, np.inf]) + 1.0 + >>> np.nanmin([1, 2, np.nan, np.NINF]) + -inf + """ return _nanop(np.min, np.inf, a, axis) def nanargmin(a, axis=None): """ - Return indices of the minimum values along the given axis of `a`, - ignoring NaNs. + Return indices of the minimum values along an axis, ignoring NaNs. - Refer to `numpy.nanargmax` for detailed documentation. + See Also + -------- + nanargmax : corresponding function for maxima; see for details. + """ return _nanop(np.argmin, np.inf, a, axis) def nanmax(a, axis=None): """ - Find the maximum along the given axis, ignoring NaNs. + Return the maximum of array elements over the given axis ignoring any NaNs. Parameters ---------- - a : array-like - Input array. - axis : {int, None}, optional - Axis along which the maximum is computed. By default `a` is flattened. + a : array_like + Array containing numbers whose maximum is desired. If `a` is not + an array, a conversion is attempted. + axis : int, optional + Axis along which the maximum is computed.The default is to compute + the maximum of the flattened array. Returns ------- - y : {ndarray, scalar} - The maximum ignoring NaNs. + y : ndarray + An array with the same shape as `a`, with the specified axis removed. + If `a` is a 0-d array, or if axis is None, a scalar is returned. The + the same dtype as `a` is returned. + See Also + -------- + numpy.amax : Maximum across array including any Not a Numbers. + numpy.nanmin : Minimum across array ignoring any Not a Numbers. + isnan : Shows which elements are Not a Number (NaN). + isfinite: Shows which elements are not: Not a Number, positive and + negative infinity + + Notes + ----- + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Positive infinity is treated as a very large number and negative infinity + is treated as a very small (i.e. negative) number. + + If the input has a integer type, an integer type is returned unless + the input contains NaNs and infinity. + Examples -------- >>> a = np.array([[1, 2], [3, np.nan]]) @@ -1491,29 +1681,35 @@ >>> np.nanmax(a, axis=1) array([ 2., 3.]) + When positive infinity and negative infinity are present: + + >>> np.nanmax([1, 2, np.nan, np.NINF]) + 2.0 + >>> np.nanmax([1, 2, np.nan, np.inf]) + inf + """ return _nanop(np.max, -np.inf, a, axis) def nanargmax(a, axis=None): """ - Return indices of the maximum values over the given axis of 'a', - ignoring NaNs. + Return indices of the maximum values over an axis, ignoring NaNs. Parameters ---------- - a : array-like + a : array_like Input data. axis : int, optional Axis along which to operate. By default flattened input is used. Returns ------- - index_array : {ndarray, int} + index_array : ndarray An array of indices or a single index value. See Also -------- - argmax + argmax, nanargmin Examples -------- @@ -1531,9 +1727,20 @@ return _nanop(np.argmax, -np.inf, a, axis) def disp(mesg, device=None, linefeed=True): - """Display a message to the given device (default is sys.stdout) - with or without a linefeed. """ + Display a message on a device + + Parameters + ---------- + mesg : string + Message to display. + device : device object with 'write' method + Device to write message. If None, defaults to ``sys.stdout`` which is + very similar to ``print``. + linefeed : bool, optional + Option whether to print a line feed or not. Defaults to True. + + """ if device is None: import sys device = sys.stdout @@ -1695,11 +1902,11 @@ Parameters ---------- - m : array-like - A 1D or 2D array containing multiple variables and observations. + m : array_like + A 1-D or 2-D array containing multiple variables and observations. Each row of `m` represents a variable, and each column a single observation of all those variables. Also see `rowvar` below. - y : array-like, optional + y : array_like, optional An additional set of variables and observations. `y` has the same form as that of `m`. rowvar : int, optional @@ -1790,7 +1997,7 @@ def corrcoef(x, y=None, rowvar=1, bias=0): """ - Correlation coefficients. + Return correlation coefficients. Please refer to the documentation for `cov` for more detail. The relationship between the correlation coefficient matrix, P, and the @@ -2014,9 +2221,9 @@ Returns ------- - out : array + out : ndarray, shape(M,) The window, normalized to one (the value one - appears only if the number of samples is odd). + appears only if `M` is odd). See Also -------- @@ -2259,18 +2466,31 @@ def i0(x): """ - Modified Bessel function of the first kind, order 0, :math:`I_0` + Modified Bessel function of the first kind, order 0. + Usually denoted :math:`I_0`. + Parameters ---------- - x : array-like, dtype float or complex + x : array_like, dtype float or complex Argument of the Bessel function. Returns ------- out : ndarray, shape z.shape, dtype z.dtype - The modified Bessel function evaluated for all elements of `x`. + The modified Bessel function evaluated at the elements of `x`. + See Also + -------- + scipy.special.iv, scipy.special.ive + + References + ---------- + .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", + 10th printing, 1964, pp. 374. http://www.math.sfu.ca/~cbm/aands/ + .. [2] Wikipedia, "Bessel function", + http://en.wikipedia.org/wiki/Bessel_function + Examples -------- >>> np.i0([0.]) @@ -2361,11 +2581,11 @@ References ---------- - .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by - digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. - John Wiley and Sons, New York, (1966). - .. [2]\tE.R. Kanasewich, "Time Sequence Analysis in Geophysics", The - University of Alberta Press, 1975, pp. 177-178. + .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by + digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. + John Wiley and Sons, New York, (1966). + .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The + University of Alberta Press, 1975, pp. 177-178. .. [3] Wikipedia, "Window function", http://en.wikipedia.org/wiki/Window_function @@ -2483,6 +2703,28 @@ return sin(y)/y def msort(a): + """ + Return a copy of an array sorted along the first axis. + + Parameters + ---------- + a : array_like + Array to be sorted. + + Returns + ------- + sorted_array : ndarray + Array of the same type and shape as `a`. + + See Also + -------- + sort + + Notes + ----- + ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. + + """ b = array(a,subok=True,copy=True) b.sort(0) return b @@ -2593,7 +2835,7 @@ ---------- y : array_like Input array to integrate. - x : {array_like, None}, optional + x : array_like, optional If `x` is None, then spacing between all `y` elements is 1. dx : scalar, optional If `x` is None, spacing given by `dx` is assumed. @@ -2707,11 +2949,11 @@ Parameters ---------- - arr : array-like + arr : array_like Input array. obj : slice, integer or an array of integers Indicate which sub-arrays to remove. - axis : integer or None + axis : integer, optional The axis along which to delete the subarray defined by `obj`. If `axis` is None, `obj` is applied to the flattened array. Modified: trunk/numpy/lib/getlimits.py =================================================================== --- trunk/numpy/lib/getlimits.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/getlimits.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -22,6 +22,8 @@ class finfo(object): """ + finfo(dtype) + Machine limits for floating point types. Attributes @@ -170,6 +172,8 @@ class iinfo: """ + iinfo(type) + Machine limits for integer types. Attributes Modified: trunk/numpy/lib/index_tricks.py =================================================================== --- trunk/numpy/lib/index_tricks.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/index_tricks.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -20,8 +20,6 @@ """ Convert a flat index into an index tuple for an array of given shape. - e.g. for a 2x2 array, unravel_index(2,(2,2)) returns (1,0). - Parameters ---------- x : int @@ -31,25 +29,26 @@ Notes ----- - Since x.flat[p] == x.max() it may be easier to use flattened indexing - than to re-map the index to a tuple. + In the Examples section, since ``arr.flat[x] == arr.max()`` it may be + easier to use flattened indexing than to re-map the index to a tuple. Examples -------- - >>> x = np.ones((5,4)) - >>> x + >>> arr = np.ones((5,4)) + >>> arr array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11], [12, 13, 14, 15], [16, 17, 18, 19]]) - >>> p = x.argmax() - >>> p + >>> x = arr.argmax() + >>> x 19 - >>> idx = np.unravel_index(p, x.shape) + >>> dims = arr.shape + >>> idx = np.unravel_index(x, dims) >>> idx (4, 3) - >>> x[idx] == x.max() + >>> arr[idx] == arr.max() True """ Modified: trunk/numpy/lib/io.py =================================================================== --- trunk/numpy/lib/io.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/io.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -81,36 +81,36 @@ def load(file, memmap=False): """ - Load pickled, ``.npy``, and ``.npz`` binary files. + Load a pickled, ``.npy``, or ``.npz`` binary file. Parameters ---------- file : file-like object or string - The file to read. It must support seek and read methods. + The file to read. It must support ``seek()`` and ``read()`` methods. memmap : bool If True, then memory-map the ``.npy`` file (or unzip the ``.npz`` file - into a temporary directory and memory-map each component). This has no - effect for a pickled file. + into a temporary directory and memory-map each component). This has + no effect for a pickled file. Returns ------- result : array, tuple, dict, etc. Data stored in the file. - - If file contains pickle data, then whatever is stored in the - pickle is returned. - - - If the file is a ``.npy`` file, then an array is returned. - - - If the file is a ``.npz`` file, then a dictionary-like object is - returned, containing {filename: array} key-value pairs, one for - every file in the archive. - Raises ------ IOError If the input file does not exist or cannot be read. + Notes + ----- + - If file contains pickle data, then whatever is stored in the + pickle is returned. + - If the file is a ``.npy`` file, then an array is returned. + - If the file is a ``.npz`` file, then a dictionary-like object is + returned, containing {filename: array} key-value pairs, one for + every file in the archive. + Examples -------- >>> np.save('/tmp/123', np.array([1, 2, 3]) @@ -178,12 +178,23 @@ format.write_array(fid, arr) def savez(file, *args, **kwds): - """Save several arrays into an .npz file format which is a zipped-archive + """ + Save several arrays into an .npz file format which is a zipped-archive of arrays If keyword arguments are given, then filenames are taken from the keywords. If arguments are passed in with no keywords, then stored file names are arr_0, arr_1, etc. + + Parameters + ---------- + file : string + File name of .npz file. + args : Arguments + Function arguments. + kwds : Keyword arguments + Keywords. + """ # Import is postponed to here since zipfile depends on gzip, an optional Modified: trunk/numpy/lib/polynomial.py =================================================================== --- trunk/numpy/lib/polynomial.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/polynomial.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -129,7 +129,7 @@ Parameters ---------- - p : (N,) array_like + p : array_like of shape(M,) Rank-1 array of polynomial co-efficients. Returns @@ -200,7 +200,7 @@ Parameters ---------- - p : poly1d or sequence + p : {array_like, poly1d} Polynomial to differentiate. A sequence is interpreted as polynomial coefficients, see `poly1d`. m : int, optional @@ -523,7 +523,7 @@ def polyval(p, x): """ - Evaluate the polynomial p at x. + Evaluate a polynomial at specific values. If p is of length N, this function returns the value: @@ -543,7 +543,7 @@ Returns ------- - values : {array, poly1d} + values : {ndarray, poly1d} If either p or x is an instance of poly1d, then an instance of poly1d is returned, otherwise a 1D array is returned. In the case where x is a poly1d, the result is the composition of the two polynomials, i.e., @@ -577,8 +577,29 @@ return y def polyadd(a1, a2): - """Adds two polynomials represented as sequences """ + Returns sum of two polynomials. + + Returns sum of polynomials; `a1` + `a2`. Input polynomials are + represented as an array_like sequence of terms or a poly1d object. + + Parameters + ---------- + a1 : {array_like, poly1d} + Polynomial as sequence of terms. + a2 : {array_like, poly1d} + Polynomial as sequence of terms. + + Returns + ------- + out : {ndarray, poly1d} + Array representing the polynomial terms. + + See Also + -------- + polyval, polydiv, polymul, polyadd + + """ truepoly = (isinstance(a1, poly1d) or isinstance(a2, poly1d)) a1 = atleast_1d(a1) a2 = atleast_1d(a2) @@ -596,8 +617,36 @@ return val def polysub(a1, a2): - """Subtracts two polynomials represented as sequences """ + Returns difference from subtraction of two polynomials input as sequences. + + Returns difference of polynomials; `a1` - `a2`. Input polynomials are + represented as an array_like sequence of terms or a poly1d object. + + Parameters + ---------- + a1 : {array_like, poly1d} + Minuend polynomial as sequence of terms. + a2 : {array_like, poly1d} + Subtrahend polynomial as sequence of terms. + + Returns + ------- + out : {ndarray, poly1d} + Array representing the polynomial terms. + + See Also + -------- + polyval, polydiv, polymul, polyadd + + Examples + -------- + .. math:: (2 x^2 + 10x - 2) - (3 x^2 + 10x -4) = (-x^2 + 2) + + >>> np.polysub([2, 10, -2], [3, 10, -4]) + array([-1, 0, 2]) + + """ truepoly = (isinstance(a1, poly1d) or isinstance(a2, poly1d)) a1 = atleast_1d(a1) a2 = atleast_1d(a2) @@ -616,8 +665,30 @@ def polymul(a1, a2): - """Multiplies two polynomials represented as sequences. """ + Returns product of two polynomials represented as sequences. + + The input arrays specify the polynomial terms in turn with a length equal + to the polynomial degree plus 1. + + Parameters + ---------- + a1 : {array_like, poly1d} + First multiplier polynomial. + a2 : {array_like, poly1d} + Second multiplier polynomial. + + Returns + ------- + out : {ndarray, poly1d} + Product of inputs. + + See Also + -------- + poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, + polyval + + """ truepoly = (isinstance(a1, poly1d) or isinstance(a2, poly1d)) a1,a2 = poly1d(a1),poly1d(a2) val = NX.convolve(a1, a2) @@ -626,9 +697,41 @@ return val def polydiv(u, v): - """Computes q and r polynomials so that u(s) = q(s)*v(s) + r(s) - and deg r < deg v. """ + Returns the quotient and remainder of polynomial division. + + The input arrays specify the polynomial terms in turn with a length equal + to the polynomial degree plus 1. + + Parameters + ---------- + u : {array_like, poly1d} + Dividend polynomial. + v : {array_like, poly1d} + Divisor polynomial. + + Returns + ------- + q : ndarray + Polynomial terms of quotient. + r : ndarray + Remainder of polynomial division. + + See Also + -------- + poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub, + polyval + + Examples + -------- + .. math:: \\frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 + + >>> x = np.array([3.0, 5.0, 2.0]) + >>> y = np.array([2.0, 1.0]) + >>> np.polydiv(x, y) + >>> (array([ 1.5 , 1.75]), array([ 0.25])) + + """ truepoly = (isinstance(u, poly1d) or isinstance(u, poly1d)) u = atleast_1d(u) v = atleast_1d(v) @@ -683,7 +786,7 @@ Parameters ---------- c_or_r : array_like - Polynomial coefficients, in decreasing powers. E.g., + Polynomial coefficients, in decreasing powers. For example, ``(1, 2, 3)`` implies :math:`x^2 + 2x + 3`. If `r` is set to True, these coefficients specify the polynomial roots (values where the polynomial evaluate to 0) instead. Modified: trunk/numpy/lib/shape_base.py =================================================================== --- trunk/numpy/lib/shape_base.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/shape_base.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -12,28 +12,28 @@ """ Apply function to 1-D slices along the given axis. - Execute `func1d(arr[i],*args)` where `func1d` takes 1-D arrays, `arr` is + Execute `func1d(a[i],*args)` where `func1d` takes 1-D arrays, `a` is the input array, and `i` is an integer that varies in order to apply the - function along the given axis for each 1-D subarray in `arr`. + function along the given axis for each 1-D subarray in `a`. Parameters ---------- func1d : function This function should be able to take 1-D arrays. It is applied to 1-D - slices of `arr` along the specified axis. + slices of `a` along the specified axis. axis : integer Axis along which `func1d` is applied. - arr : ndarray + a : ndarray Input array. args : any Additional arguments to `func1d`. Returns ------- - outarr : ndarray - The output array. The shape of `outarr` depends on the return - value of `func1d`. If it returns arrays with the same shape as the - input arrays it receives, `outarr` has the same shape as `arr`. + out : ndarray + The output array. The shape of `out` is identical to the shape of `a`, + except along the `axis` dimension, whose length is equal to the size + of the return value of `func1d`. See Also -------- @@ -112,28 +112,28 @@ """ Apply a function repeatedly over multiple axes. - `func` is called as `res = func(a, axis)`, with `axis` the first element - of `axes`. The result `res` of the function call has to have - the same or one less dimension(s) as `a`. If `res` has one less dimension - than `a`, a dimension is then inserted before `axis`. + `func` is called as `res = func(a, axis)`, where `axis` is the first + element of `axes`. The result `res` of the function call must have + either the same dimensions as `a` or one less dimension. If `res` has one + less dimension than `a`, a dimension is inserted before `axis`. The call to `func` is then repeated for each axis in `axes`, with `res` as the first argument. Parameters ---------- func : function - This function should take two arguments, `func(a, axis)`. - arr : ndarray + This function must take two arguments, `func(a, axis)`. + a : ndarray Input array. axes : array_like - Axes over which `func` has to be applied, the elements should be + Axes over which `func` is applied, the elements must be integers. Returns ------- val : ndarray - The output array. The number of dimensions is the same as `a`, - the shape can be different, this depends on whether `func` changes + The output array. The number of dimensions is the same as `a`, but + the shape can be different. This depends on whether `func` changes the shape of its output with respect to its input. See Also @@ -448,7 +448,7 @@ Stack arrays in sequence horizontally (column wise) Take a sequence of arrays and stack them horizontally to make - a single array. hstack will rebuild arrays divided by hsplit. + a single array. Rebuild arrays divided by ``hsplit``. Parameters ---------- @@ -458,8 +458,19 @@ Returns ------- stacked : ndarray - Ndarray formed by stacking the given arrays. + The array formed by stacking the given arrays. + See Also + -------- + vstack : Stack along first axis. + dstack : Stack along third axis. + concatenate : Join arrays. + hsplit : Split array along second axis. + + Notes + ----- + Equivalent to ``np.concatenate(tup, axis=1)`` + Examples -------- >>> a = np.array((1,2,3)) @@ -512,11 +523,12 @@ def dstack(tup): """ - Stack arrays in sequence depth wise (along third dimension) + Stack arrays in sequence depth wise (along third axis) - Take a sequence of arrays and stack them along the third axis. + Takes a sequence of arrays and stack them along the third axis + to make a single array. Rebuilds arrays divided by ``dsplit``. This is a simple way to stack 2D arrays (images) into a single - 3D array for processing. dstack will rebuild arrays divided by dsplit. + 3D array for processing. Parameters ---------- @@ -524,6 +536,22 @@ Arrays to stack. All of them must have the same shape along all but the third axis. + Returns + ------- + stacked : ndarray + The array formed by stacking the given arrays. + + See Also + -------- + vstack : Stack along first axis. + hstack : Stack along second axis. + concatenate : Join arrays. + dsplit : Split array along third axis. + + Notes + ----- + Equivalent to ``np.concatenate(tup, axis=2)`` + Examples -------- >>> a = np.array((1,2,3)) Modified: trunk/numpy/lib/twodim_base.py =================================================================== --- trunk/numpy/lib/twodim_base.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/twodim_base.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -308,13 +308,13 @@ Number of rows in the array. M : int, optional Number of columns in the array. - By default, `M` is taken to equal to `N`. + By default, `M` is taken equal to `N`. k : int, optional The sub-diagonal below which the array is filled. - ``k = 0`` is the main diagonal, while ``k < 0`` is below it, - and ``k > 0`` is above. The default is 0. + `k` = 0 is the main diagonal, while `k` < 0 is below it, + and `k` > 0 is above. The default is 0. dtype : dtype, optional - Data type of the returned array. The default is `float`. + Data type of the returned array. The default is float. Returns ------- @@ -341,13 +341,13 @@ def tril(m, k=0): """ - Lower triangular. + Lower triangle of an array. - Return a copy of an array with elements above the k-th diagonal zeroed. + Return a copy of an array with elements above the `k`-th diagonal zeroed. Parameters ---------- - m : array-like, shape (M, N) + m : array_like, shape (M, N) Input array. k : int Diagonal above which to zero elements. @@ -377,7 +377,7 @@ def triu(m, k=0): """ - Upper triangular. + Upper triangle of an array. Construct a copy of a matrix with elements below the k-th diagonal zeroed. @@ -453,9 +453,9 @@ Parameters ---------- - x : array-like (N,) + x : array_like, shape(N,) A sequence of values to be histogrammed along the first dimension. - y : array-like (N,) + y : array_like, shape(M,) A sequence of values to be histogrammed along the second dimension. bins : int or [int, int] or array-like or [array, array], optional The bin specification: @@ -465,7 +465,7 @@ * the bin edges for the two dimensions (x_edges=y_edges=bins), * the bin edges in each dimension (x_edges, y_edges = bins). - range : array-like, (2,2), optional + range : array_like, shape(2,2), optional The leftmost and rightmost edges of the bins along each dimension (if not specified explicitly in the `bins` parameters): [[xmin, xmax], [ymin, ymax]]. All values outside of this range will be @@ -473,7 +473,7 @@ normed : boolean, optional If False, returns the number of samples in each bin. If True, returns the bin density, ie, the bin count divided by the bin area. - weights : array-like (N,), optional + weights : array-like, shape(N,), optional An array of values `w_i` weighing each sample `(x_i, y_i)`. Weights are normalized to 1 if normed is True. If normed is False, the values of the returned histogram are equal to the sum of the weights belonging to the @@ -481,13 +481,13 @@ Returns ------- - H : array (nx, ny) + H : ndarray, shape(nx, ny) The bidimensional histogram of samples x and y. Values in x are histogrammed along the first dimension and values in y are histogrammed along the second dimension. - xedges : array (nx,) + xedges : ndarray, shape(nx,) The bin edges along the first dimension. - yedges : array (ny,) + yedges : ndarray, shape(ny,) The bin edges along the second dimension. See Also Modified: trunk/numpy/lib/type_check.py =================================================================== --- trunk/numpy/lib/type_check.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/type_check.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -42,7 +42,32 @@ return l[0][1] def asfarray(a, dtype=_nx.float_): - """asfarray(a,dtype=None) returns a as a float array.""" + """ + Return an array converted to float type. + + Parameters + ---------- + a : array_like + Input array. + dtype : string or dtype object, optional + Float type code to coerce input array `a`. If one of the 'int' dtype, + it is replaced with float64. + + Returns + ------- + out : ndarray, float + Input `a` as a float ndarray. + + Examples + -------- + >>> np.asfarray([2, 3]) + array([ 2., 3.]) + >>> np.asfarray([2, 3], dtype='float') + array([ 2., 3.]) + >>> np.asfarray([2, 3], dtype='int8') + array([ 2., 3.]) + + """ dtype = _nx.obj2sctype(dtype) if not issubclass(dtype, _nx.inexact): dtype = _nx.float_ @@ -54,7 +79,7 @@ Parameters ---------- - val : {array_like, scalar} + val : array_like Input array. Returns @@ -100,10 +125,27 @@ return asanyarray(val).imag def iscomplex(x): - """Return a boolean array where elements are True if that element - is complex (has non-zero imaginary part). + """ + Return a bool array, True if element is complex (non-zero imaginary part). For scalars, return a boolean. + + Parameters + ---------- + x : array_like + Input array. + + Returns + ------- + out : ndarray, bool + Output array. + + Examples + -------- + >>> x = np.array([1,2,3.j]) + >>> np.iscomplex(x) + array([False, False, True], dtype=bool) + """ ax = asanyarray(x) if issubclass(ax.dtype.type, _nx.complexfloating): @@ -219,7 +261,7 @@ Parameters ---------- - a : {array_like, scalar} + a : array_like Input array. tol : scalar Tolerance for the complex part of the elements in the array. @@ -241,6 +283,16 @@ 2.2204460492503131e-16. You can use 'np.finfo(np.float).eps' to print out the machine epsilon for floats. + Examples + -------- + >>> np.finfo(np.float).eps # DOCTEST +skip + 2.2204460492503131e-16 + + >>> np.real_if_close([2.1 + 4e-14j], tol = 1000) + array([ 2.1]) + >>> np.real_if_close([2.1 + 4e-13j], tol = 1000) + array([ 2.1 +4.00000000e-13j]) + """ a = asanyarray(a) if not issubclass(a.dtype.type, _nx.complexfloating): @@ -255,8 +307,25 @@ def asscalar(a): - """Convert an array of size 1 to its scalar equivalent. """ + Convert an array of size 1 to its scalar equivalent. + + Parameters + ---------- + a : ndarray + Input array. + + Returns + ------- + out : scalar + Scalar of size 1 array. + + Examples + -------- + >>> np.asscalar(np.array([24])) + >>> 24 + + """ return a.item() #----------------------------------------------------------------------------- @@ -322,19 +391,28 @@ """ Return the inexact scalar type which is most common in a list of arrays. - The return type will always be a inexact scalar type, even if all - the arrays are integer arrays + The return type will always be an inexact scalar type, even if all the + arrays are integer arrays Parameters ---------- - arrays: sequence of array_like - Input sequence of arrays. + array1, array2, ... : ndarray + Input arrays. Returns ------- - out: data type code + out : data type code Data type code. + See Also + -------- + dtype + + Examples + -------- + >>> np.common_type(np.arange(4), np.array([45,6]), np.array([45.0, 6.0])) + + """ is_complex = False precision = 0 Modified: trunk/numpy/lib/ufunclike.py =================================================================== --- trunk/numpy/lib/ufunclike.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/ufunclike.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -7,8 +7,39 @@ import numpy.core.numeric as nx def fix(x, y=None): - """ Round x to nearest integer towards zero. """ + Round to nearest integer towards zero. + + Round an array of floats element-wise to nearest integer towards zero. + The rounded values are returned as floats. + + Parameters + ---------- + x : array_like + An array of floats to be rounded + y : ndarray, optional + Output array + + Returns + ------- + out : ndarray of floats + The array of rounded numbers + + See Also + -------- + floor : Round downwards + around : Round to given number of decimals + + Examples + -------- + >>> np.fix(3.14) + 3.0 + >>> np.fix(3) + 3.0 + >>> np.fix([2.1, 2.9, -2.1, -2.9]) + array([ 2., 2., -2., -2.]) + + """ x = nx.asanyarray(x) if y is None: y = nx.zeros_like(x) @@ -19,8 +50,11 @@ def isposinf(x, y=None): """ - Return True where x is +infinity, and False otherwise. + Shows which elements of the input are positive infinity. + Returns a numpy array resulting from an element-wise test for positive + infinity. + Parameters ---------- x : array_like @@ -31,16 +65,54 @@ Returns ------- y : ndarray - A boolean array where y[i] = True only if x[i] = +Inf. + A numpy boolean array with the same dimensions as the input. + If second argument is not supplied then a numpy boolean array is returned + with values True where the corresponding element of the input is positive + infinity and values False where the element of the input is not positive + infinity. + If second argument is supplied then an numpy integer array is returned + with values 1 where the corresponding element of the input is positive + positive infinity. + See Also -------- - isneginf, isfinite + isinf : Shows which elements are negative or positive infinity. + isneginf : Shows which elements are negative infinity. + isnan : Shows which elements are Not a Number (NaN). + isfinite: Shows which elements are not: Not a number, positive and + negative infinity + Notes + ----- + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Also that positive infinity is not equivalent to negative infinity. But + infinity is equivalent to positive infinity. + + Errors result if second argument is also supplied with scalar input or + if first and second arguments have different shapes. + + Numpy's definitions for positive infinity (PINF) and negative infinity + (NINF) may be change in the future versions. + + Examples -------- + >>> np.isposinf(np.PINF) + array(True, dtype=bool) + >>> np.isposinf(np.inf) + array(True, dtype=bool) + >>> np.isposinf(np.NINF) + array(False, dtype=bool) >>> np.isposinf([-np.inf, 0., np.inf]) - array([ False, False, True], dtype=bool) + array([False, False, True], dtype=bool) + >>> x=np.array([-np.inf, 0., np.inf]) + >>> y=np.array([2,2,2]) + >>> np.isposinf(x,y) + array([1, 0, 0]) + >>> y + array([1, 0, 0]) """ if y is None: @@ -95,11 +167,10 @@ Returns ------- - y : {ndarray, scalar} + y : ndarray The logarithm to the base 2 of `x` elementwise. NaNs are returned where `x` is negative. - See Also -------- log, log1p, log10 Modified: trunk/numpy/lib/utils.py =================================================================== --- trunk/numpy/lib/utils.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/lib/utils.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -42,15 +42,23 @@ return d def get_numarray_include(type=None): - """Return the directory in the package that contains the numpy/*.h header - files. + """ + Return the directory that contains the numarray \\*.h header files. - Extension modules that need to compile against numpy should use this - function to locate the appropriate include directory. Using distutils: + Extension modules that need to compile against numarray should use this + function to locate the appropriate include directory. - import numpy - Extension('extension_name', ... - include_dirs=[numpy.get_numarray_include()]) + Notes + ----- + When using ``distutils``, for example in ``setup.py``. + :: + + import numpy as np + ... + Extension('extension_name', ... + include_dirs=[np.get_numarray_include()]) + ... + """ from numpy.numarray import get_numarray_include_dirs include_dirs = get_numarray_include_dirs() @@ -96,10 +104,7 @@ depdoc = '%s is DEPRECATED!! -- use %s instead' % (oldname, newname,) def newfunc(*args,**kwds): - """ - Use get_include, get_numpy_include is DEPRECATED. - - """ + """Use get_include, get_numpy_include is DEPRECATED.""" warnings.warn(str1, DeprecationWarning) return func(*args, **kwds) @@ -335,18 +340,30 @@ return thedict, dictlist def info(object=None,maxwidth=76,output=sys.stdout,toplevel='numpy'): - """Get help information for a function, class, or module. + """ + Get help information for a function, class, or module. - Example: - >>> np.info(np.polyval) # doctest: +SKIP + Parameters + ---------- + object : optional + Input object to get information about. + maxwidth : int, optional + Printing width. + output : file like object open for writing, optional + Write into file like object. + toplevel : string, optional + Start search at this level. - polyval(p, x) + Examples + -------- + >>> np.info(np.polyval) # doctest: +SKIP - Evaluate the polymnomial p at x. + polyval(p, x) - Description: - If p is of length N, this function returns the value: - p[0]*(x**N-1) + p[1]*(x**N-2) + ... + p[N-2]*x + p[N-1] + Evaluate the polymnomial p at x. + + ... + """ global _namedict, _dictlist # Local import to speed up numpy's import time. Modified: trunk/numpy/linalg/linalg.py =================================================================== --- trunk/numpy/linalg/linalg.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/linalg/linalg.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -1137,7 +1137,7 @@ Parameters ---------- - a : array-like, shape (M, M) + a : array_like, shape (M, M) Input array. Returns Modified: trunk/numpy/ma/__init__.py =================================================================== --- trunk/numpy/ma/__init__.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/ma/__init__.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -17,7 +17,7 @@ nan The mean is calculated using roughly ``np.sum(x)/len(x)``, but since -any number added to ``NaN`` [*]_ produces ``NaN``, this doesn't work. Enter +any number added to ``NaN`` [1]_ produces ``NaN``, this doesn't work. Enter masked arrays: >>> m = np.ma.masked_array(x, np.isnan(x)) @@ -32,7 +32,7 @@ >>> np.mean(m) 2.6666666666666665 -.. [*] Not-a-Number, a floating point value that is the result of an +.. [1] Not-a-Number, a floating point value that is the result of an invalid operation. """ Modified: trunk/numpy/ma/core.py =================================================================== --- trunk/numpy/ma/core.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/ma/core.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -986,14 +986,14 @@ # def masked_object(x, value, copy=True, shrink=True): """ - Mask the array ``x`` where the data are exactly equal to value. + Mask the array `x` where the data are exactly equal to value. This function is suitable only for object arrays: for floating - point, please use :func:`masked_values` instead. + point, please use `masked_values`_ instead. Parameters ---------- - x : array-like + x : array_like Array to mask value : var Comparison value @@ -1474,7 +1474,28 @@ view.__doc__ = ndarray.view.__doc__ #............................................. def astype(self, newtype): - """Returns a copy of the array cast to newtype.""" + """ + Returns a copy of the MaskedArray cast to given newtype. + + Returns + ------- + output : MaskedArray + A copy of self cast to input newtype. + The returned record shape matches self.shape. + + Examples + -------- + >>> x = np.ma.array([[1,2,3.1],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) + >>> print x + [[1.0 -- 3.1] + [-- 5.0 --] + [7.0 -- 9.0]] + >>> print x.astype(int32) + [[1 -- 3] + [-- 5 --] + [7 -- 9]] + + """ newtype = np.dtype(newtype) output = self._data.astype(newtype).view(type(self)) output._update_from(self) @@ -1862,8 +1883,26 @@ return result def compressed(self): - """Return a 1-D array of all the non-masked data. + """ + Return a 1-D array of all the non-masked data. + Returns + ------- + data : ndarray. + A new ndarray holding the non-masked data is returned. + + Notes + ----- + + The result is NOT a MaskedArray ! + + Examples + -------- + >>> x = array(arange(5), mask=[0]+[1]*4) + >>> print x.compressed() + [0] + >>> print type(x.compressed()) + + """ data = ndarray.ravel(self._data) if self._mask is not nomask: @@ -2169,7 +2208,26 @@ flatten = _arraymethod('flatten') # def ravel(self): - """Returns a 1D version of self, as a view.""" + """ + Returns a 1D version of self, as a view. + + Returns + ------- + MaskedArray + Output view is of shape ``(self.size,)`` (or + ``(np.ma.product(self.shape),)``). + + Examples + -------- + >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) + >>> print x + [[1 -- 3] + [-- 5 --] + [7 -- 9]] + >>> print x.ravel() + [1 -- 3 -- 5 -- 7 -- 9] + + """ r = ndarray.ravel(self._data).view(type(self)) r._update_from(self) if self._mask is not nomask: @@ -2182,28 +2240,41 @@ # def reshape (self, *s, **kwargs): """ - Returns a masked array containing the data of a, but with a new shape. - The result is a view to the original array; if this is not possible, - a ValueError is raised. + Returns a masked array containing the data of a, but with a new shape. + The result is a view to the original array; if this is not possible, + a ValueError is raised. - Parameters - ---------- - shape : shape tuple or int - The new shape should be compatible with the original shape. If an - integer, then the result will be a 1D array of that length. - order : {'C', 'F'}, optional - Determines whether the array data should be viewed as in C - (row-major) order or FORTRAN (column-major) order. + Parameters + ---------- + shape : shape tuple or int + The new shape should be compatible with the original shape. If an + integer, then the result will be a 1D array of that length. + order : {'C', 'F'}, optional + Determines whether the array data should be viewed as in C + (row-major) order or FORTRAN (column-major) order. - Returns - ------- - reshaped_array : array - A new view to the array. + Returns + ------- + reshaped_array : array + A new view to the array. - Notes - ----- - If you want to modify the shape in place, please use ``a.shape = s`` + Notes + ----- + If you want to modify the shape in place, please use ``a.shape = s`` + Examples + -------- + >>> x = np.ma.array([[1,2],[3,4]], mask=[1,0,0,1]) + >>> print x + [[-- 2] + [3 --]] + >>> x = x.reshape((4,1)) + >>> print x + [[--] + [2] + [3] + [--]] + """ kwargs.update(order=kwargs.get('order','C')) result = self._data.reshape(*s, **kwargs).view(type(self)) @@ -2235,14 +2306,49 @@ return None # def put(self, indices, values, mode='raise'): - """Set storage-indexed locations to corresponding values. + """ + Set storage-indexed locations to corresponding values. - a.put(values, indices, mode) sets a.flat[n] = values[n] for - each n in indices. If ``values`` is shorter than ``indices`` - then it will repeat. If ``values`` has some masked values, the - initial mask is updated in consequence, else the corresponding - values are unmasked. + Sets self._data.flat[n] = values[n] for each n in indices. + If `values` is shorter than `indices` then it will repeat. + If `values` has some masked values, the initial mask is updated + in consequence, else the corresponding values are unmasked. + Parameters + ---------- + indicies : 1-D array_like + Target indices, interpreted as integers. + values : array_like + Values to place in self._data copy at target indices. + mode : {'raise', 'wrap', 'clip'}, optional + Specifies how out-of-bounds indices will behave. + 'raise' : raise an error. + 'wrap' : wrap around. + 'clip' : clip to the range. + + Notes + ----- + `values` can be a scalar or length 1 array. + + Examples + -------- + >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) + >>> print x + [[1 -- 3] + [-- 5 --] + [7 -- 9]] + >>> x.put([0,4,8],[10,20,30]) + >>> print x + [[10 -- 3] + [-- 20 --] + [7 -- 30]] + + >>> x.put(4,999) + >>> print x + [[10 -- 3] + [-- 999 --] + [7 -- 30]] + """ m = self._mask # Hard mask: Get rid of the values/indices that fall on masked data @@ -2279,37 +2385,36 @@ #............................................ def all(self, axis=None, out=None): - """a.all(axis=None, out=None) + """ + Check if all of the elements of `a` are true. - Check if all of the elements of `a` are true. + Performs a :func:`logical_and` over the given axis and returns the result. + Masked values are considered as True during computation. + For convenience, the output array is masked where ALL the values along the + current axis are masked: if the output would have been a scalar and that + all the values are masked, then the output is `masked`. - Performs a :func:`logical_and` over the given axis and returns the result. - Masked values are considered as True during computation. - For convenience, the output array is masked where ALL the values along the - current axis are masked: if the output would have been a scalar and that - all the values are masked, then the output is `masked`. + Parameters + ---------- + axis : {None, integer} + Axis to perform the operation over. + If None, perform over flattened array. + out : {None, array}, optional + Array into which the result can be placed. Its type is preserved + and it must be of the right shape to hold the output. - Parameters - ---------- - axis : {None, integer} - Axis to perform the operation over. - If None, perform over flattened array. - out : {None, array}, optional - Array into which the result can be placed. Its type is preserved - and it must be of the right shape to hold the output. + See Also + -------- + all : equivalent function - See Also - -------- - all : equivalent function + Examples + -------- + >>> np.ma.array([1,2,3]).all() + True + >>> a = np.ma.array([1,2,3], mask=True) + >>> (a.all() is np.ma.masked) + True - Example - ------- - >>> np.ma.array([1,2,3]).all() - True - >>> a = np.ma.array([1,2,3], mask=True) - >>> (a.all() is np.ma.masked) - True - """ mask = self._mask.all(axis) if out is None: @@ -2327,26 +2432,25 @@ def any(self, axis=None, out=None): - """a.any(axis=None, out=None) + """ + Check if any of the elements of `a` are true. - Check if any of the elements of `a` are true. + Performs a logical_or over the given axis and returns the result. + Masked values are considered as False during computation. - Performs a logical_or over the given axis and returns the result. - Masked values are considered as False during computation. + Parameters + ---------- + axis : {None, integer} + Axis to perform the operation over. + If None, perform over flattened array and return a scalar. + out : {None, array}, optional + Array into which the result can be placed. Its type is preserved + and it must be of the right shape to hold the output. - Parameters - ---------- - axis : {None, integer} - Axis to perform the operation over. - If None, perform over flattened array and return a scalar. - out : {None, array}, optional - Array into which the result can be placed. Its type is preserved - and it must be of the right shape to hold the output. + See Also + -------- + any : equivalent function - See Also - -------- - any : equivalent function - """ mask = self._mask.all(axis) if out is None: @@ -2383,8 +2487,7 @@ def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None): - """a.trace(offset=0, axis1=0, axis2=1, dtype=None, out=None) - + """ Return the sum along the offset diagonal of the array's indicated `axis1` and `axis2`. @@ -2401,27 +2504,49 @@ def sum(self, axis=None, dtype=None, out=None): - """a.sum(axis=None, dtype=None, out=None) + """ + Return the sum of the array elements over the given axis. + Masked elements are set to 0 internally. - Return the sum of the array elements over the given axis. - Masked elements are set to 0 internally. + Parameters + ---------- + axis : {None, -1, int}, optional + Axis along which the sum is computed. The default + (`axis` = None) is to compute over the flattened array. + dtype : {None, dtype}, optional + Determines the type of the returned array and of the accumulator + where the elements are summed. If dtype has the value None and + the type of a is an integer type of precision less than the default + platform integer, then the default platform integer precision is + used. Otherwise, the dtype is the same as that of a. + out : {None, ndarray}, optional + Alternative output array in which to place the result. It must + have the same shape and buffer length as the expected output + but the type will be cast if necessary. - Parameters - ---------- - axis : {None, -1, int}, optional - Axis along which the sum is computed. The default - (`axis` = None) is to compute over the flattened array. - dtype : {None, dtype}, optional - Determines the type of the returned array and of the accumulator - where the elements are summed. If dtype has the value None and - the type of a is an integer type of precision less than the default - platform integer, then the default platform integer precision is - used. Otherwise, the dtype is the same as that of a. - out : {None, ndarray}, optional - Alternative output array in which to place the result. It must - have the same shape and buffer length as the expected output - but the type will be cast if necessary. + Returns + ------- + sum_along_axis : MaskedArray or scalar + An array with the same shape as self, with the specified + axis removed. If self is a 0-d array, or if `axis` is None, a scalar + is returned. If an output array is specified, a reference to + `out` is returned. + Examples + -------- + >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) + >>> print x + [[1 -- 3] + [-- 5 --] + [7 -- 9]] + >>> print x.sum() + 25 + >>> print x.sum(axis=1) + [4 5 16] + >>> print x.sum(axis=0) + [8 5 12] + >>> print type(x.sum(axis=0, dtype=np.int64)[0]) + """ _mask = ndarray.__getattribute__(self, '_mask') @@ -2506,53 +2631,53 @@ def prod(self, axis=None, dtype=None, out=None): """ - Return the product of the array elements over the given axis. - Masked elements are set to 1 internally for computation. + Return the product of the array elements over the given axis. + Masked elements are set to 1 internally for computation. - Parameters - ---------- - axis : {None, int}, optional - Axis over which the product is taken. If None is used, then the - product is over all the array elements. - dtype : {None, dtype}, optional - Determines the type of the returned array and of the accumulator - where the elements are multiplied. If ``dtype`` has the value ``None`` - and the type of a is an integer type of precision less than the default - platform integer, then the default platform integer precision is - used. Otherwise, the dtype is the same as that of a. - out : {None, array}, optional - Alternative output array in which to place the result. It must have - the same shape as the expected output but the type will be cast if - necessary. + Parameters + ---------- + axis : {None, int}, optional + Axis over which the product is taken. If None is used, then the + product is over all the array elements. + dtype : {None, dtype}, optional + Determines the type of the returned array and of the accumulator + where the elements are multiplied. If ``dtype`` has the value ``None`` + and the type of a is an integer type of precision less than the default + platform integer, then the default platform integer precision is + used. Otherwise, the dtype is the same as that of a. + out : {None, array}, optional + Alternative output array in which to place the result. It must have + the same shape as the expected output but the type will be cast if + necessary. - Returns - ------- - product_along_axis : {array, scalar}, see dtype parameter above. - Returns an array whose shape is the same as a with the specified - axis removed. Returns a 0d array when a is 1d or axis=None. - Returns a reference to the specified output array if specified. + Returns + ------- + product_along_axis : {array, scalar}, see dtype parameter above. + Returns an array whose shape is the same as a with the specified + axis removed. Returns a 0d array when a is 1d or axis=None. + Returns a reference to the specified output array if specified. - See Also - -------- - prod : equivalent function + See Also + -------- + prod : equivalent function - Examples - -------- - >>> np.prod([1.,2.]) - 2.0 - >>> np.prod([1.,2.], dtype=np.int32) - 2 - >>> np.prod([[1.,2.],[3.,4.]]) - 24.0 - >>> np.prod([[1.,2.],[3.,4.]], axis=1) - array([ 2., 12.]) + Notes + ----- + Arithmetic is modular when using integer types, and no error is raised + on overflow. - Notes - ----- - Arithmetic is modular when using integer types, and no error is raised - on overflow. + Examples + -------- + >>> np.prod([1.,2.]) + 2.0 + >>> np.prod([1.,2.], dtype=np.int32) + 2 + >>> np.prod([[1.,2.],[3.,4.]]) + 24.0 + >>> np.prod([[1.,2.],[3.,4.]], axis=1) + array([ 2., 12.]) - """ + """ _mask = ndarray.__getattribute__(self, '_mask') newmask = _mask.all(axis=axis) # No explicit output @@ -2716,6 +2841,16 @@ #............................................ def round(self, decimals=0, out=None): + """ + Return an array rounded a to the given number of decimals. + + Refer to `numpy.around` for full documentation. + + See Also + -------- + numpy.around : equivalent function + + """ result = self._data.round(decimals=decimals, out=out).view(type(self)) result._mask = self._mask result._update_from(self) @@ -2780,22 +2915,40 @@ def argmin(self, axis=None, fill_value=None, out=None): - """a.argmin(axis=None, out=None) + """ + Return array of indices to the minimum values along the given axis. - Return array of indices to the minimum values along the given axis. + Parameters + ---------- + axis : {None, integer} + If None, the index is into the flattened array, otherwise along + the specified axis + fill_value : {var}, optional + Value used to fill in the masked values. If None, the output of + minimum_fill_value(self._data) is used instead. + out : {None, array}, optional + Array into which the result can be placed. Its type is preserved + and it must be of the right shape to hold the output. - Parameters - ---------- - axis : {None, integer} - If None, the index is into the flattened array, otherwise along - the specified axis - fill_value : {var}, optional - Value used to fill in the masked values. If None, the output of - minimum_fill_value(self._data) is used instead. - out : {None, array}, optional - Array into which the result can be placed. Its type is preserved - and it must be of the right shape to hold the output. + Returns + ------- + {ndarray, scalar} + If multi-dimension input, returns a new ndarray of indices to the + minimum values along the given axis. Otherwise, returns a scalar + of index to the minimum values along the given axis. + Examples + -------- + >>> x = np.ma.array(arange(4), mask=[1,1,0,0]) + >>> x.shape = (2,2) + >>> print x + [[-- --] + [2 3]] + >>> print x.argmin(axis=0, fill_value=-1) + [0 0] + >>> print x.argmin(axis=0, fill_value=9) + [1 1] + """ if fill_value is None: fill_value = minimum_fill_value(self) @@ -2804,37 +2957,36 @@ def argmax(self, axis=None, fill_value=None, out=None): - """a.argmax(axis=None, out=None) + """ + Returns array of indices of the maximum values along the given axis. + Masked values are treated as if they had the value fill_value. - Returns array of indices of the maximum values along the given axis. - Masked values are treated as if they had the value fill_value. + Parameters + ---------- + axis : {None, integer} + If None, the index is into the flattened array, otherwise along + the specified axis + fill_value : {var}, optional + Value used to fill in the masked values. If None, the output of + maximum_fill_value(self._data) is used instead. + out : {None, array}, optional + Array into which the result can be placed. Its type is preserved + and it must be of the right shape to hold the output. - Parameters - ---------- - axis : {None, integer} - If None, the index is into the flattened array, otherwise along - the specified axis - fill_value : {var}, optional - Value used to fill in the masked values. If None, the output of - maximum_fill_value(self._data) is used instead. - out : {None, array}, optional - Array into which the result can be placed. Its type is preserved - and it must be of the right shape to hold the output. + Returns + ------- + index_array : {integer_array} - Returns - ------- - index_array : {integer_array} + Examples + -------- + >>> a = np.arange(6).reshape(2,3) + >>> a.argmax() + 5 + >>> a.argmax(0) + array([1, 1, 1]) + >>> a.argmax(1) + array([2, 2]) - Examples - -------- - >>> a = np.arange(6).reshape(2,3) - >>> a.argmax() - 5 - >>> a.argmax(0) - array([1, 1, 1]) - >>> a.argmax(1) - array([2, 2]) - """ if fill_value is None: fill_value = maximum_fill_value(self._data) @@ -2975,33 +3127,32 @@ #........................ def max(self, axis=None, out=None, fill_value=None): - """a.max(axis=None, out=None, fill_value=None) + """ + Return the maximum along a given axis. - Return the maximum along a given axis. + Parameters + ---------- + axis : {None, int}, optional + Axis along which to operate. By default, ``axis`` is None and the + flattened input is used. + out : array_like, optional + Alternative output array in which to place the result. Must + be of the same shape and buffer length as the expected output. + fill_value : {var}, optional + Value used to fill in the masked values. + If None, use the output of maximum_fill_value(). - Parameters - ---------- - axis : {None, int}, optional - Axis along which to operate. By default, ``axis`` is None and the - flattened input is used. - out : array_like, optional - Alternative output array in which to place the result. Must - be of the same shape and buffer length as the expected output. - fill_value : {var}, optional - Value used to fill in the masked values. - If None, use the output of maximum_fill_value(). + Returns + ------- + amax : array_like + New array holding the result. + If ``out`` was specified, ``out`` is returned. - Returns - ------- - amax : array_like - New array holding the result. - If ``out`` was specified, ``out`` is returned. + See Also + -------- + maximum_fill_value + Returns the maximum filling value for a given datatype. - See Also - -------- - maximum_fill_value - Returns the maximum filling value for a given datatype. - """ _mask = ndarray.__getattribute__(self, '_mask') newmask = _mask.all(axis=axis) @@ -3031,30 +3182,28 @@ return out def ptp(self, axis=None, out=None, fill_value=None): - """a.ptp(axis=None, out=None) + """ + Return (maximum - minimum) along the the given dimension + (i.e. peak-to-peak value). - Return (maximum - minimum) along the the given dimension - (i.e. peak-to-peak value). + Parameters + ---------- + axis : {None, int}, optional + Axis along which to find the peaks. If None (default) the + flattened array is used. + out : {None, array_like}, optional + Alternative output array in which to place the result. It must + have the same shape and buffer length as the expected output + but the type will be cast if necessary. + fill_value : {var}, optional + Value used to fill in the masked values. - Parameters - ---------- - axis : {None, int}, optional - Axis along which to find the peaks. If None (default) the - flattened array is used. - out : {None, array_like}, optional - Alternative output array in which to place the result. It must - have the same shape and buffer length as the expected output - but the type will be cast if necessary. - fill_value : {var}, optional - Value used to fill in the masked values. + Returns + ------- + ptp : ndarray. + A new array holding the result, unless ``out`` was + specified, in which case a reference to ``out`` is returned. - Returns - ------- - ptp : ndarray. - A new array holding the result, unless ``out`` was - specified, in which case a reference to ``out`` is returned. - - """ if out is None: result = self.max(axis=axis, fill_value=fill_value) @@ -3116,8 +3265,7 @@ def tostring(self, fill_value=None, order='C'): """ Return a copy of array data as a Python string containing the raw bytes - in the array. - The array is filled beforehand. + in the array. The array is filled beforehand. Parameters ---------- @@ -3125,15 +3273,15 @@ Value used to fill in the masked values. If None, uses self.fill_value instead. order : {string} - Order of the data item in the copy {"C","F","A"}. - "C" -- C order (row major) - "Fortran" -- Fortran order (column major) - "Any" -- Current order of array. + Order of the data item in the copy {'C','F','A'}. + 'C' -- C order (row major) + 'Fortran' -- Fortran order (column major) + 'Any' -- Current order of array. None -- Same as "Any" - Warnings - -------- - As for :meth:`ndarray.tostring`, information about the shape, dtype..., + Notes + ----- + As for method:`ndarray.tostring`, information about the shape, dtype..., but also fill_value will be lost. """ @@ -3143,15 +3291,35 @@ raise NotImplementedError("Not implemented yet, sorry...") def torecords(self): - """Transforms a masked array into a flexible-type array with two fields: + """ + Transforms a MaskedArray into a flexible-type array with two fields: * the ``_data`` field stores the ``_data`` part of the array; * the ``_mask`` field stores the ``_mask`` part of the array; - Warnings - -------- + Returns + ------- + record : ndarray + A new flexible-type ndarray with two fields: the first element + containing a value, the second element containing the corresponding + mask boolean. The returned record shape matches self.shape. + + Notes + ----- A side-effect of transforming a masked array into a flexible ndarray is - that metainformation (``fill_value``, ...) will be lost. + that meta information (``fill_value``, ...) will be lost. + Examples + -------- + >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) + >>> print x + [[1 -- 3] + [-- 5 --] + [7 -- 9]] + >>> print x.torecords() + [[(1, False) (2, True) (3, False)] + [(4, True) (5, False) (6, True)] + [(7, False) (8, True) (9, False)]] + """ # Get the basic dtype .... ddtype = self.dtype Modified: trunk/numpy/ma/extras.py =================================================================== --- trunk/numpy/ma/extras.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/ma/extras.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -371,29 +371,30 @@ def median(a, axis=None, out=None, overwrite_input=False): - """Compute the median along the specified axis. + """ + Compute the median along the specified axis. Returns the median of the array elements. Parameters ---------- - a : array-like + a : array_like Input array or object that can be converted to an array - axis : {None, int}, optional - Axis along which the medians are computed. The default (axis=None) is to - compute the median along a flattened version of the array. - out : {None, ndarray}, optional + axis : int, optional + Axis along which the medians are computed. The default (axis=None) is + to compute the median along a flattened version of the array. + out : ndarray, optional Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type will be cast if necessary. overwrite_input : {False, True}, optional - If True, then allow use of memory of input array (a) for - calculations. The input array will be modified by the call to - median. This will save memory when you do not need to preserve - the contents of the input array. Treat the input as undefined, - but it will probably be fully or partially sorted. Default is - False. Note that, if overwrite_input is true, and the input - is not already an ndarray, an error will be raised. + If True, then allow use of memory of input array (a) for + calculations. The input array will be modified by the call to + median. This will save memory when you do not need to preserve + the contents of the input array. Treat the input as undefined, + but it will probably be fully or partially sorted. Default is + False. Note that, if overwrite_input is true, and the input + is not already an ndarray, an error will be raised. Returns ------- @@ -404,7 +405,7 @@ float64, or the input datatype otherwise. See Also - ------- + -------- mean Notes @@ -697,36 +698,40 @@ def cov(x, y=None, rowvar=True, bias=False, allow_masked=True): - """Estimates the covariance matrix. + """ + Estimates the covariance matrix. Normalization is by (N-1) where N is the number of observations (unbiased estimate). If bias is True then normalization is by N. By default, masked values are recognized as such. If x and y have the same - shape, a common mask is allocated: if x[i,j] is masked, then y[i,j] will also - be masked. - Setting `allow_masked` to False will raise an exception if values are missing - in either of the input arrays. + shape, a common mask is allocated: if x[i,j] is masked, then y[i,j] will + also be masked. + Setting `allow_masked` to False will raise an exception if values are + missing in either of the input arrays. Parameters ---------- - x : array-like + x : array_like Input data. If x is a 1D array, returns the variance. If x is a 2D array, returns the covariance matrix. - y : {None, array-like}, optional + y : array_like, optional Optional set of variables. rowvar : {False, True} optional - If rowvar is true, then each row is a variable with observations in columns. - If rowvar is False, each column is a variable and the observations are in - the rows. + If rowvar is true, then each row is a variable with observations in + columns. + If rowvar is False, each column is a variable and the observations are + in the rows. bias : {False, True} optional - Whether to use a biased (True) or unbiased (False) estimate of the covariance. - If bias is True, then the normalization is by N, the number of observations. + Whether to use a biased (True) or unbiased (False) estimate of the + covariance. + If bias is True, then the normalization is by N, the number of + observations. Otherwise, the normalization is by (N-1). allow_masked : {True, False} optional - If True, masked values are propagated pair-wise: if a value is masked in x, - the corresponding value is masked in y. + If True, masked values are propagated pair-wise: if a value is masked + in x, the corresponding value is masked in y. If False, raises a ValueError exception when some values are missing. Raises Modified: trunk/numpy/matlib.py =================================================================== --- trunk/numpy/matlib.py 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/matlib.py 2008-10-28 00:13:44 UTC (rev 5963) @@ -14,28 +14,163 @@ return ndarray.__new__(matrix, shape, dtype, order=order) def ones(shape, dtype=None, order='C'): - """return a matrix initialized to all ones """ + Matrix of ones. + + Return a matrix of given shape and type, filled with ones. + + Parameters + ---------- + shape : {sequence of ints, int} + Shape of the matrix + dtype : data-type, optional + The desired data-type for the matrix, default is np.float64. + order : {'C', 'F'}, optional + Whether to store matrix in C- or Fortran-contiguous order, + default is 'C'. + + Returns + ------- + out : matrix + Matrix of ones of given shape, dtype, and order. + + See Also + -------- + ones : Array of ones. + matlib.zeros : Zero matrix. + + Notes + ----- + If `shape` has length one i.e. ``(N,)``, or is a scalar ``N``, + `out` becomes a single row matrix of shape ``(1,N)``. + + Examples + -------- + >>> np.matlib.ones((2,3)) + matrix([[ 1., 1., 1.], + [ 1., 1., 1.]]) + + >>> np.matlib.ones(2) + matrix([[ 1., 1.]] + + """ a = ndarray.__new__(matrix, shape, dtype, order=order) a.fill(1) return a def zeros(shape, dtype=None, order='C'): - """return a matrix initialized to all zeros """ + Zero matrix. + + Return a matrix of given shape and type, filled with zeros + + Parameters + ---------- + shape : {sequence of ints, int} + Shape of the matrix + dtype : data-type, optional + The desired data-type for the matrix, default is np.float64. + order : {'C', 'F'}, optional + Whether to store the result in C- or Fortran-contiguous order, + default is 'C'. + + Returns + ------- + out : matrix + Zero matrix of given shape, dtype, and order. + + See Also + -------- + zeros : Zero array. + matlib.ones : Matrix of ones. + + Notes + ----- + If `shape` has length one i.e. ``(N,)``, or is a scalar ``N``, + `out` becomes a single row matrix of shape ``(1,N)``. + + Examples + -------- + >>> np.matlib.zeros((2,3)) + matrix([[ 0., 0., 0.], + [ 0., 0., 0.]]) + + >>> np.matlib.zeros(2) + matrix([[ 0., 0.]] + + """ a = ndarray.__new__(matrix, shape, dtype, order=order) a.fill(0) return a def identity(n,dtype=None): - """identity(n) returns the identity matrix of shape n x n. """ + Returns the square identity matrix of given size. + + Parameters + ---------- + n : int + Size of identity matrix + + dtype : data-type, optional + Data-type of the output. Defaults to ``float``. + + Returns + ------- + out : matrix + `n` x `n` matrix with its main diagonal set to one, + and all other elements zero. + + See Also + -------- + identity : Equivalent array function. + matlib.eye : More general matrix identity function. + + Notes + ----- + For more detailed documentation, see the docstring of the equivalent + array function ``np.identity`` + + """ a = array([1]+n*[0],dtype=dtype) b = empty((n,n),dtype=dtype) b.flat = a return b def eye(n,M=None, k=0, dtype=float): + """ + Return a matrix with ones on the diagonal and zeros elsewhere. + + Parameters + ---------- + n : int + Number of rows in the output. + M : int, optional + Number of columns in the output, defaults to n. + k : int, optional + Index of the diagonal: 0 refers to the main diagonal, + a positive value refers to an upper diagonal, + and a negative value to a lower diagonal. + dtype : dtype, optional + Data-type of the returned matrix. + + Returns + ------- + I : matrix + A `n` x `M` matrix where all elements are equal to zero, + except for the k-th diagonal, whose values are equal to one. + + See Also + -------- + eye : Equivalent array function + matlib.identity : Square identity matrix + + Notes + ----- + For more detailed docuemtation, see the docstring of the equivalent + array function ``np.eye``. + + """ return asmatrix(np.eye(n,M,k,dtype)) def rand(*args): Modified: trunk/numpy/random/mtrand/mtrand.pyx =================================================================== --- trunk/numpy/random/mtrand/mtrand.pyx 2008-10-27 23:40:52 UTC (rev 5962) +++ trunk/numpy/random/mtrand/mtrand.pyx 2008-10-28 00:13:44 UTC (rev 5963) @@ -532,7 +532,7 @@ Parameters ---------- - seed : {None, int, array-like} + 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``. @@ -1160,8 +1160,71 @@ """ gamma(shape, scale=1.0, size=None) - Gamma distribution. + 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 @@ -1188,8 +1251,82 @@ """ f(dfnum, dfden, size=None) - F distribution. + 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 @@ -1831,8 +1968,8 @@ >>> 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) ), + >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta) + ... * np.exp( -np.exp( -(bins - mu) /beta) ), ... linewidth=2, color='r') >>> plt.show() @@ -1848,11 +1985,11 @@ >>> 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) ), + >>> 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) ), + >>> plt.plot(bins, 1/(beta * np.sqrt(2 * np.pi)) + ... * np.exp(-(bins - mu)**2 / (2 * beta**2)), ... linewidth=2, color='g') >>> plt.show() @@ -1878,8 +2015,72 @@ """ logistic(loc=0.0, scale=1.0, size=None) - Logistic distribution. + 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 @@ -2126,8 +2327,82 @@ """ binomial(n, p, size=None) - Binomial distribution of n trials and p probability of success. + 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 @@ -2377,13 +2652,85 @@ """ hypergeometric(ngood, nbad, nsample, size=None) - Hypergeometric distribution. + Draw samples from a Hypergeometric distribution. - Consider an urn with ngood "good" balls and nbad "bad" balls. If one - were to draw nsample balls from the urn without replacement, then - the hypergeometric distribution describes the distribution of "good" - balls in the sample. + 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 @@ -2424,8 +2771,75 @@ """ logseries(p, size=None) - Logarithmic series distribution. + 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 From numpy-svn at scipy.org Mon Oct 27 20:24:37 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 27 Oct 2008 19:24:37 -0500 (CDT) Subject: [Numpy-svn] r5964 - trunk/numpy/random/mtrand Message-ID: <20081028002437.5C42CC7C009@scipy.org> Author: ptvirtan Date: 2008-10-27 19:24:27 -0500 (Mon, 27 Oct 2008) New Revision: 5964 Modified: trunk/numpy/random/mtrand/mtrand.c Log: Regenerate mtrand.c due to docstring changes Modified: trunk/numpy/random/mtrand/mtrand.c =================================================================== --- trunk/numpy/random/mtrand/mtrand.c 2008-10-28 00:13:44 UTC (rev 5963) +++ trunk/numpy/random/mtrand/mtrand.c 2008-10-28 00:24:27 UTC (rev 5964) @@ -1,4 +1,4 @@ -/* Generated by Pyrex 0.9.6.4 on Sun Aug 24 16:14:30 2008 */ +/* 0.9.7 on Tue Oct 28 02:15:49 2008 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -247,7 +247,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":131 */ + /* "/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;} @@ -258,7 +258,7 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":134 */ + /* "/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; @@ -278,18 +278,18 @@ arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":135 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":135 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":136 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":136 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":137 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":139 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":139 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -323,7 +323,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":148 */ + /* "/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;} @@ -334,7 +334,7 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":151 */ + /* "/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; @@ -354,18 +354,18 @@ arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":152 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":152 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":153 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":153 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":154 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":156 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":156 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -386,8 +386,6 @@ return __pyx_r; } -static PyObject *__pyx_n_ValueError; - static PyObject *__pyx_k61p; static char __pyx_k61[] = "size is not compatible with inputs"; @@ -412,44 +410,44 @@ __pyx_v_itera = ((PyArrayIterObject *)Py_None); Py_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":167 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":167 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":168 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":169 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":169 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":170 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":170 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":171 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":172 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":173 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":174 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":174 */ PyArray_ITER_NEXT(__pyx_v_itera); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":176 */ + /* "/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; @@ -469,50 +467,48 @@ arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":177 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":177 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":178 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":180 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; goto __pyx_L1;} + __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_4, 0, __pyx_k61p); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; goto __pyx_L1;} + 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_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":182 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":183 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":184 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":185 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":185 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,1); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":186 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":186 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -547,7 +543,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":195 */ + /* "/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;} @@ -558,7 +554,7 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":198 */ + /* "/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; @@ -578,18 +574,18 @@ arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":199 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":199 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":200 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":200 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":201 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":203 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":203 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -633,48 +629,48 @@ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":216 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":216 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":217 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":218 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":219 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":219 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":220 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":221 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":222 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":223 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":224 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":224 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":226 */ + /* "/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; @@ -694,56 +690,54 @@ arrayObject = ((PyArrayObject *)__pyx_5); Py_DECREF(__pyx_5); __pyx_5 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":227 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":227 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":228 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":229 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} + __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_5, 0, __pyx_k62p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":231 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":232 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":233 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":234 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":235 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":235 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,1); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":236 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":236 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,2); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":237 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":237 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -778,7 +772,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":247 */ + /* "/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;} @@ -789,7 +783,7 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":250 */ + /* "/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; @@ -809,18 +803,18 @@ arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":251 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":251 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":252 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":252 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":253 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":255 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":255 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -866,51 +860,51 @@ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":269 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":269 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":270 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":271 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":272 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":272 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":273 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":274 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":275 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":276 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":277 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":278 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":278 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":280 */ + /* "/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; @@ -930,56 +924,54 @@ arrayObject = ((PyArrayObject *)__pyx_5); Py_DECREF(__pyx_5); __pyx_5 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":281 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":281 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":282 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":284 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;} + __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_5, 0, __pyx_k63p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":286 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":287 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":288 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":289 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":290 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":291 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":291 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":292 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":292 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1002,8 +994,6 @@ return __pyx_r; } -static PyObject *__pyx_n_int; - 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; @@ -1017,7 +1007,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":300 */ + /* "/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;} @@ -1028,36 +1018,35 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":303 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":304 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":304 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":305 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":305 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":306 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":308 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":308 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1091,7 +1080,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":316 */ + /* "/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;} @@ -1102,36 +1091,35 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":319 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":320 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":320 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":321 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":321 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":322 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":324 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":324 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1175,115 +1163,112 @@ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":335 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":335 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":336 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":337 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":338 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":338 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":339 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":340 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":341 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":342 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":343 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":343 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":345 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;} + __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_5, 0, __pyx_v_size); - 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 = 345; goto __pyx_L1;} + 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_5); __pyx_5 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":346 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":346 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":347 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":348 */ + /* "/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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;} __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_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_Raise(__pyx_5, 0, 0); + Py_DECREF(__pyx_5); __pyx_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":350 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":351 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":352 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":353 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":354 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":354 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,1); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":355 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":355 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,2); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":357 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":357 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1318,7 +1303,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":365 */ + /* "/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;} @@ -1329,36 +1314,35 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":368 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":369 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":369 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":370 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":370 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":371 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":373 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":373 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1402,115 +1386,112 @@ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":384 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":384 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":385 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":386 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":387 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":387 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":388 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":389 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":390 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":391 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":392 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":392 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":394 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; goto __pyx_L1;} + __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_5, 0, __pyx_v_size); - 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 = 394; goto __pyx_L1;} + 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_5); __pyx_5 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":395 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":395 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":396 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":397 */ + /* "/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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} __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_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_Raise(__pyx_5, 0, 0); + Py_DECREF(__pyx_5); __pyx_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":399 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":400 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":401 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":402 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":403 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":403 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,1); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":404 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":404 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,2); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":406 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":406 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1545,7 +1526,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":415 */ + /* "/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;} @@ -1556,36 +1537,35 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":418 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":419 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":419 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":420 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":420 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":421 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":423 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":423 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1631,118 +1611,115 @@ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":436 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":436 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":437 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":438 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":439 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":439 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":440 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":441 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":442 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":443 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":444 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":445 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":445 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":447 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; goto __pyx_L1;} + __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_5, 0, __pyx_v_size); - 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 = 447; goto __pyx_L1;} + 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_5); __pyx_5 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":448 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":448 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":449 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":451 */ + /* "/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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;} __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_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_Raise(__pyx_5, 0, 0); + Py_DECREF(__pyx_5); __pyx_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":453 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":454 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":455 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":456 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":457 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":458 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":458 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":460 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":460 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1778,7 +1755,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":468 */ + /* "/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;} @@ -1789,36 +1766,35 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":471 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":472 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":472 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":473 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":473 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":474 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":476 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":476 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1863,105 +1839,102 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); __pyx_v_itera = ((PyArrayIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":487 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":487 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":488 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":489 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":489 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":490 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":490 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":491 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":492 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":493 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":494 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":494 */ PyArray_ITER_NEXT(__pyx_v_itera); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":496 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":497 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":497 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":498 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":499 */ + /* "/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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;} __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_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":501 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":502 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":503 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":504 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":504 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,1); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":505 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":505 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1991,29 +1964,29 @@ long __pyx_v_i; double __pyx_r; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":510 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":510 */ __pyx_v_sum = (__pyx_v_darr[0]); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":511 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":511 */ __pyx_v_c = 0.0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":512 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":513 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":514 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":514 */ __pyx_v_t = (__pyx_v_sum + __pyx_v_y); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":515 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":516 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":516 */ __pyx_v_sum = __pyx_v_t; } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":517 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":517 */ __pyx_r = __pyx_v_sum; goto __pyx_L0; @@ -2035,10 +2008,10 @@ Py_INCREF(__pyx_v_self); Py_INCREF(__pyx_v_seed); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":547 */ + /* "/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)))); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":549 */ + /* "/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); @@ -2069,10 +2042,10 @@ __pyx_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != NULL); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":553 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":554 */ + /* "/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; } @@ -2081,7 +2054,6 @@ Py_DECREF(__pyx_v_self); } -static PyObject *__pyx_n_type; static PyObject *__pyx_n_integer; static PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ @@ -2095,8 +2067,7 @@ int __pyx_1; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - unsigned long __pyx_5; + 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; @@ -2105,62 +2076,56 @@ arrayObject_obj = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_iseed = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":570 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; goto __pyx_L1;} + __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_3, 0, __pyx_v_seed); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; goto __pyx_L1;} + 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; - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; goto __pyx_L1;} - __pyx_1 = __pyx_4 == __pyx_2; - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_1) { - __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; goto __pyx_L1;} - rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); + __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_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_integer); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; goto __pyx_L1;} + __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; - __pyx_1 = PyObject_IsInstance(__pyx_v_seed,__pyx_4); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":575 */ - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; goto __pyx_L1;} + /* "/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_3, 0, __pyx_v_seed); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; goto __pyx_L1;} + 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_3); __pyx_3 = 0; Py_DECREF(__pyx_v_iseed); - __pyx_v_iseed = __pyx_4; - __pyx_4 = 0; + __pyx_v_iseed = __pyx_3; + __pyx_3 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":576 */ - __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_v_iseed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;} - rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); + /* "/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*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":578 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":579 */ + /* "/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:; @@ -2170,7 +2135,6 @@ __pyx_L1:; Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); __Pyx_AddTraceback("mtrand.RandomState.seed"); __pyx_r = 0; __pyx_L0:; @@ -2201,7 +2165,7 @@ Py_INCREF(__pyx_v_self); arrayObject_state = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":592 */ + /* "/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; @@ -2222,10 +2186,10 @@ arrayObject_state = ((PyArrayObject *)__pyx_1); Py_DECREF(__pyx_1); __pyx_1 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":593 */ + /* "/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)))); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":594 */ + /* "/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; @@ -2245,7 +2209,7 @@ arrayObject_state = ((PyArrayObject *)__pyx_3); Py_DECREF(__pyx_3); __pyx_3 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":595 */ + /* "/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;} @@ -2279,8 +2243,6 @@ return __pyx_r; } -static PyObject *__pyx_n_TypeError; - static PyObject *__pyx_k70p; static PyObject *__pyx_k71p; @@ -2299,10 +2261,10 @@ PyObject *__pyx_v_cached_gaussian; PyObject *__pyx_r; PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - int __pyx_3; - PyObject *__pyx_4 = 0; - Py_ssize_t __pyx_5; + 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}; @@ -2315,83 +2277,79 @@ __pyx_v_has_gauss = Py_None; Py_INCREF(Py_None); __pyx_v_cached_gaussian = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":614 */ - __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + /* "/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_2; - __pyx_2 = 0; + __pyx_v_algorithm_name = __pyx_1; + __pyx_1 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":615 */ - if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;} - __pyx_3 = __pyx_3 != 0; - if (__pyx_3) { - __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; goto __pyx_L1;} + /* "/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_2, 0, __pyx_k70p); - __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_2); __pyx_2 = 0; - __Pyx_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":617 */ + /* "/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_2 = PyObject_GetIter(__pyx_1); if (!__pyx_2) {__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_4 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;} + __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_4; - __pyx_4 = 0; - __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;} - __pyx_3 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;} + __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_3; - if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":618 */ - __pyx_5 = PyObject_Length(__pyx_v_state); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;} - __pyx_3 = (__pyx_5 == 3); - if (__pyx_3) { + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":619 */ - __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; goto __pyx_L1;} + /* "/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_4; - __pyx_4 = 0; + __pyx_v_has_gauss = __pyx_1; + __pyx_1 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":620 */ - __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; goto __pyx_L1;} + /* "/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_1; - __pyx_1 = 0; + __pyx_v_cached_gaussian = __pyx_3; + __pyx_3 = 0; goto __pyx_L3; } /*else*/ { - __pyx_2 = PySequence_GetSlice(__pyx_v_state, 3, 5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;} - __pyx_4 = PyObject_GetIter(__pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_1 = __Pyx_UnpackItem(__pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;} + __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_2 = __Pyx_UnpackItem(__pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;} + __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_2; - __pyx_2 = 0; - if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":623 */ + /* "/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))); @@ -2401,58 +2359,53 @@ } goto __pyx_L5; __pyx_L4:; - Py_XDECREF(__pyx_2); __pyx_2 = 0; - Py_XDECREF(__pyx_4); __pyx_4 = 0; + Py_XDECREF(__pyx_3); __pyx_3 = 0; Py_XDECREF(__pyx_1); __pyx_1 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":625 */ - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; goto __pyx_L1;} - __pyx_3 = PyErr_ExceptionMatches(__pyx_2); - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (__pyx_3) { + /* "/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_4, &__pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; goto __pyx_L1;} + 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_4); __pyx_4 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_5); __pyx_5 = 0; goto __pyx_L5; } goto __pyx_L1; __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":628 */ - __pyx_3 = ((arrayObject_obj->dimensions[0]) != 624); - if (__pyx_3) { - __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; goto __pyx_L1;} + /* "/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_4, 0, __pyx_k71p); - __pyx_1 = PyObject_CallObject(__pyx_6, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __Pyx_Raise(__pyx_1, 0, 0); - 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 = 629; goto __pyx_L1;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":630 */ + /* "/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)))); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":631 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":632 */ - __pyx_3 = 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_3; + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":633 */ + /* "/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; @@ -2460,8 +2413,8 @@ goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_4); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_5); Py_XDECREF(__pyx_6); __Pyx_AddTraceback("mtrand.RandomState.set_state"); __pyx_r = 0; @@ -2673,51 +2626,49 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":698 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":698 */ __pyx_1 = __pyx_v_high == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":699 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":699 */ __pyx_v_lo = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":700 */ + /* "/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*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":702 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":703 */ + /* "/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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":705 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":705 */ __pyx_v_diff = ((__pyx_v_hi - __pyx_v_lo) - 1); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":706 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":706 */ __pyx_1 = (__pyx_v_diff < 0); if (__pyx_1) { - __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; goto __pyx_L1;} + __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_4, 0, __pyx_k72p); - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; goto __pyx_L1;} + 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_Raise(__pyx_5, 0, 0); - Py_DECREF(__pyx_5); __pyx_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":709 */ + /* "/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;} @@ -2728,36 +2679,35 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":712 */ + /* "/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_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__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_3 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;} __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); - 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 = 712; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + 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_3))); + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_5))); Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_3); - Py_DECREF(__pyx_3); __pyx_3 = 0; + arrayObject = ((PyArrayObject *)__pyx_5); + Py_DECREF(__pyx_5); __pyx_5 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":713 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":713 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":714 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":714 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":715 */ + /* "/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))); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":717 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":717 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -2794,19 +2744,19 @@ Py_INCREF(__pyx_v_self); __pyx_v_bytestring = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":742 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":743 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":743 */ __pyx_v_bytes = PyString_AS_STRING(__pyx_v_bytestring); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":744 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":745 */ + /* "/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; @@ -2856,13 +2806,13 @@ __pyx_v_odiff = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_temp = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":822 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":822 */ __pyx_v_flow = PyFloat_AsDouble(__pyx_v_low); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":823 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":823 */ __pyx_v_fhigh = PyFloat_AsDouble(__pyx_v_high); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":824 */ + /* "/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;} @@ -2873,24 +2823,24 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":826 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":826 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":827 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":828 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":829 */ + /* "/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; @@ -2906,17 +2856,17 @@ __pyx_v_temp = __pyx_4; __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":830 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":830 */ Py_INCREF(__pyx_v_temp); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":832 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":833 */ + /* "/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; @@ -3088,16 +3038,16 @@ Py_INCREF(__pyx_v_high); Py_INCREF(__pyx_v_size); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":904 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":904 */ __pyx_1 = __pyx_v_high == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":905 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":906 */ + /* "/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; @@ -3106,7 +3056,7 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":907 */ + /* "/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;} @@ -3206,34 +3156,32 @@ __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1004 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1004 */ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1005 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1005 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1006 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1006 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1007 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1007 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;} + __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_3, 0, __pyx_k74p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1009 */ + /* "/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; @@ -3242,54 +3190,52 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1011 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1011 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1013 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1014 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1015 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} + __pyx_v_oscale = ((PyArrayObject *)__pyx_2); 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 = 1015; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; goto __pyx_L1;} __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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; @@ -3298,10 +3244,10 @@ } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1017 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -3359,51 +3305,47 @@ __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_ob = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1059 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1059 */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1060 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1060 */ __pyx_v_fb = PyFloat_AsDouble(__pyx_v_b); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1061 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1061 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1062 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1062 */ __pyx_1 = (__pyx_v_fa <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; goto __pyx_L1;} + __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_3, 0, __pyx_k76p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1064 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1064 */ __pyx_1 = (__pyx_v_fb <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; goto __pyx_L1;} + __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_3, 0, __pyx_k77p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1066 */ + /* "/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; @@ -3412,54 +3354,52 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1068 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1068 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1070 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1071 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_b,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1072 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} + __pyx_v_ob = ((PyArrayObject *)__pyx_2); 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 = 1072; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; goto __pyx_L1;} __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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; @@ -3468,49 +3408,47 @@ } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1074 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + /* "/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_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;} + 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_5); - __pyx_5 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + 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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; goto __pyx_L1;} __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - 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 = 1075; goto __pyx_L1;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1076 */ - __pyx_3 = __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_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;} - __pyx_r = __pyx_3; - __pyx_3 = 0; + /* "/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); @@ -3560,31 +3498,29 @@ Py_INCREF(__pyx_v_size); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1115 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1115 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1116 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1116 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1117 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1117 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; goto __pyx_L1;} + __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_3, 0, __pyx_k80p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1119 */ + /* "/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; @@ -3593,59 +3529,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1121 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1121 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1123 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1124 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; 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 = 1124; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; 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 = 1124; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;} + 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_3); - __pyx_3 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; goto __pyx_L1;} __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1126 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -3720,31 +3654,29 @@ Py_INCREF(__pyx_v_size); __pyx_v_oshape = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1147 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1147 */ __pyx_v_fshape = PyFloat_AsDouble(__pyx_v_shape); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1148 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1148 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1149 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1149 */ __pyx_1 = (__pyx_v_fshape <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;} + __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_3, 0, __pyx_k82p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1151 */ + /* "/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; @@ -3753,59 +3685,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1153 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1153 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1154 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1155 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; 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 = 1155; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; 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 = 1155; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;} + 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_3); - __pyx_3 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; goto __pyx_L1;} __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1157 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -3836,7 +3766,7 @@ 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 Gamma distribution.\n\n "; +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; @@ -3862,52 +3792,48 @@ __pyx_v_oshape = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1169 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1232 */ __pyx_v_fshape = PyFloat_AsDouble(__pyx_v_shape); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1170 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1233 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1171 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1234 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1172 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1235 */ __pyx_1 = (__pyx_v_fshape <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; goto __pyx_L1;} + __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_3, 0, __pyx_k84p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1174 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1237 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; goto __pyx_L1;} + __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_3, 0, __pyx_k85p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1176 */ - __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 = 1176; goto __pyx_L1;} + /* "/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; @@ -3915,105 +3841,101 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1178 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1241 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1179 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_shape,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1180 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1181 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} + __pyx_v_oscale = ((PyArrayObject *)__pyx_2); 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 = 1181; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1182; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1183 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} + /* "/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_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} + 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 = 1183; 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 = 1183; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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 = 1183; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1185 */ - __pyx_3 = __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_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; goto __pyx_L1;} - __pyx_r = __pyx_3; - __pyx_3 = 0; + /* "/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); @@ -4046,7 +3968,7 @@ 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 F distribution.\n\n "; +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; @@ -4071,52 +3993,48 @@ __pyx_v_odfnum = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_odfden = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1197 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1334 */ __pyx_v_fdfnum = PyFloat_AsDouble(__pyx_v_dfnum); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1198 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1335 */ __pyx_v_fdfden = PyFloat_AsDouble(__pyx_v_dfden); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1199 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1336 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1200 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1337 */ __pyx_1 = (__pyx_v_fdfnum <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;} + __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_3, 0, __pyx_k88p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1202 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1339 */ __pyx_1 = (__pyx_v_fdfden <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;} + __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_3, 0, __pyx_k89p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1204 */ - __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 = 1204; goto __pyx_L1;} + /* "/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; @@ -4124,105 +4042,101 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1206 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1343 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1208 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_dfnum,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1209 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_dfden,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1210 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} + __pyx_v_odfden = ((PyArrayObject *)__pyx_2); 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 = 1210; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1211; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1212 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} + /* "/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_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} + 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 = 1212; 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 = 1212; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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 = 1212; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1214 */ - __pyx_3 = __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_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; goto __pyx_L1;} - __pyx_r = __pyx_3; - __pyx_3 = 0; + /* "/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); @@ -4291,72 +4205,66 @@ __pyx_v_odfden = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_ononc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1226 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1363 */ __pyx_v_fdfnum = PyFloat_AsDouble(__pyx_v_dfnum); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1227 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1364 */ __pyx_v_fdfden = PyFloat_AsDouble(__pyx_v_dfden); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1228 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1365 */ __pyx_v_fnonc = PyFloat_AsDouble(__pyx_v_nonc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1229 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1366 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1230 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1367 */ __pyx_1 = (__pyx_v_fdfnum <= 1); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; goto __pyx_L1;} + __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_3, 0, __pyx_k92p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1232 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1369 */ __pyx_1 = (__pyx_v_fdfden <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; goto __pyx_L1;} + __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_3, 0, __pyx_k93p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1234 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1371 */ __pyx_1 = (__pyx_v_fnonc < 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; goto __pyx_L1;} + __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_3, 0, __pyx_k94p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1236 */ - __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 = 1236; goto __pyx_L1;} + /* "/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; @@ -4364,151 +4272,145 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1239 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1376 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1241 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_dfnum,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1242 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_dfden,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); - Py_DECREF(((PyObject *)__pyx_v_odfden)); - __pyx_v_odfden = ((PyArrayObject *)__pyx_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1243 */ - __pyx_2 = PyArray_FROM_OTF(__pyx_v_nonc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; goto __pyx_L1;} + /* "/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_ononc)); - __pyx_v_ononc = ((PyArrayObject *)__pyx_2); + Py_DECREF(((PyObject *)__pyx_v_odfden)); + __pyx_v_odfden = ((PyArrayObject *)__pyx_2); Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1245 */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} + /* "/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; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} + + /* "/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 = PyFloat_FromDouble(1.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} + __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_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); + __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_4, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} + 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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;} + __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_4, 0, __pyx_k95p); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_4); __pyx_4 = 0; __Pyx_Raise(__pyx_3, 0, 0); Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; goto __pyx_L1;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1247 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} + /* "/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_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} + __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_4, 0, ((PyObject *)__pyx_v_odfden)); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; 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 = 1247; 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 = 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_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;} + __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_2, 0, __pyx_k96p); - __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;} + 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; - 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 = 1248; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; goto __pyx_L1;} goto __pyx_L7; } __pyx_L7:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1249 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;} - __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;} + /* "/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_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; 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 = 1249; goto __pyx_L1;} - __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;} + __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_2, 0, ((PyObject *)__pyx_v_ononc)); - 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 = 1249; 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 = 1249; 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 = 1249; goto __pyx_L1;} + 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_3); __pyx_3 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;} + __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_5, 0, __pyx_k97p); - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - __Pyx_Raise(__pyx_3, 0, 0); + 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_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1251 */ - __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_odfnum,__pyx_v_odfden,__pyx_v_ononc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; goto __pyx_L1;} - __pyx_r = __pyx_2; - __pyx_2 = 0; + /* "/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); @@ -4559,32 +4461,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_odf = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1321 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1458 */ __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1322 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1459 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1323 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1460 */ __pyx_1 = (__pyx_v_fdf <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; goto __pyx_L1;} + __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_3, 0, __pyx_k98p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1325 */ - __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 = 1325; goto __pyx_L1;} + /* "/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; @@ -4592,59 +4492,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1327 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1464 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1329 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1330 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; 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 = 1330; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; 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 = 1330; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; goto __pyx_L1;} + 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 = 1330; 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 = 1330; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 1330; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1332 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -4700,52 +4598,48 @@ __pyx_v_odf = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_ononc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1355 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1492 */ __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1356 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1493 */ __pyx_v_fnonc = PyFloat_AsDouble(__pyx_v_nonc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1357 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1494 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1358 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1495 */ __pyx_1 = (__pyx_v_fdf <= 1); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; goto __pyx_L1;} + __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_3, 0, __pyx_k100p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1496; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1360 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1497 */ __pyx_1 = (__pyx_v_fnonc <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; goto __pyx_L1;} + __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_3, 0, __pyx_k101p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1362 */ - __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 = 1362; goto __pyx_L1;} + /* "/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; @@ -4753,105 +4647,101 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1365 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1502 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1367 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1368 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_nonc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1369 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} + __pyx_v_ononc = ((PyArrayObject *)__pyx_2); 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 = 1369; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1370; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1371 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} + /* "/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_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} + 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 = 1371; 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 = 1371; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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 = 1371; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1373 */ - __pyx_3 = __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_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; goto __pyx_L1;} - __pyx_r = __pyx_3; - __pyx_3 = 0; + /* "/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); @@ -4884,7 +4774,7 @@ 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 = 1383; goto __pyx_L1;} + __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; @@ -4928,32 +4818,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_odf = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1395 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1532 */ __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1396 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1533 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1397 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1534 */ __pyx_1 = (__pyx_v_fdf <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; goto __pyx_L1;} + __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_3, 0, __pyx_k104p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1399 */ - __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 = 1399; goto __pyx_L1;} + /* "/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; @@ -4961,59 +4849,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1401 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1538 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1403 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1403; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1404 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; 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 = 1404; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; 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 = 1404; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; goto __pyx_L1;} + 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 = 1404; 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 = 1404; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 1404; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1406 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1406; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5065,35 +4951,33 @@ __pyx_v_omu = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_okappa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1488 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1625 */ __pyx_v_fmu = PyFloat_AsDouble(__pyx_v_mu); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1489 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1626 */ __pyx_v_fkappa = PyFloat_AsDouble(__pyx_v_kappa); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1490 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1627 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1491 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1628 */ __pyx_1 = (__pyx_v_fkappa < 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; goto __pyx_L1;} + __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_3, 0, __pyx_k106p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1629; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1493 */ - __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 = 1493; goto __pyx_L1;} + /* "/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; @@ -5101,66 +4985,64 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1495 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1632 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1497 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_mu,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1498 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_kappa,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1499 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} + __pyx_v_okappa = ((PyArrayObject *)__pyx_2); 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 = 1499; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1500; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1501 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5209,32 +5091,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1579 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1716 */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1580 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1717 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1581 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1718 */ __pyx_1 = (__pyx_v_fa <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; goto __pyx_L1;} + __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_3, 0, __pyx_k108p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1583 */ - __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 = 1583; goto __pyx_L1;} + /* "/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; @@ -5242,59 +5122,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1585 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1722 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1587 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1587; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1588 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; 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 = 1588; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; 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 = 1588; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; goto __pyx_L1;} + 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 = 1588; 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 = 1588; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 1588; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1590 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1590; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5341,32 +5219,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1678 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1815 */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1679 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1816 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1680 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1817 */ __pyx_1 = (__pyx_v_fa <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; goto __pyx_L1;} + __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_3, 0, __pyx_k110p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1682 */ - __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 = 1682; goto __pyx_L1;} + /* "/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; @@ -5374,59 +5250,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1684 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1821 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1686 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1687 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; 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 = 1687; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; 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 = 1687; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; goto __pyx_L1;} + 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 = 1687; 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 = 1687; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 1687; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1689 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1689; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5473,32 +5347,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1701 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1838 */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1702 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1839 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1703 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1840 */ __pyx_1 = (__pyx_v_fa <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; goto __pyx_L1;} + __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_3, 0, __pyx_k112p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1705 */ - __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 = 1705; goto __pyx_L1;} + /* "/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; @@ -5506,59 +5378,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1707 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1844 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1709 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1709; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1710 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; 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 = 1710; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; 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 = 1710; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; goto __pyx_L1;} + 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 = 1710; 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 = 1710; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 1710; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1712 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5612,35 +5482,33 @@ __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1739 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1876 */ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1740 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1877 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1741 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1878 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1742 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1879 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; goto __pyx_L1;} + __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_3, 0, __pyx_k114p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1744 */ - __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 = 1744; goto __pyx_L1;} + /* "/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; @@ -5648,66 +5516,64 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1746 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1883 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1747 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1747; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1747; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1748 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; + __pyx_v_oscale = ((PyArrayObject *)__pyx_2); + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1749 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; 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 = 1749; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1750; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1751 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5736,7 +5602,7 @@ 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 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; @@ -5763,35 +5629,33 @@ __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1863 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2000 */ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1864 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2001 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1865 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2002 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1866 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2003 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; goto __pyx_L1;} + __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_3, 0, __pyx_k116p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1868 */ - __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 = 1868; goto __pyx_L1;} + /* "/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; @@ -5799,66 +5663,64 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1870 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2007 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1871 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1871; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1871; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1872 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1872; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1872; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; + __pyx_v_oscale = ((PyArrayObject *)__pyx_2); + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1873 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; 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 = 1873; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1874; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1874; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1874; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1874; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2011; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1875 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5887,7 +5749,7 @@ 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 Logistic distribution.\n\n "; +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; @@ -5914,35 +5776,33 @@ __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1887 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2088 */ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1888 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2089 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1889 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2090 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1890 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2091 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; goto __pyx_L1;} + __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_3, 0, __pyx_k118p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2092; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1892 */ - __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 = 1892; goto __pyx_L1;} + /* "/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; @@ -5950,66 +5810,64 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1894 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2095 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1895 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1895; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1895; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1896 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1896; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1896; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; + __pyx_v_oscale = ((PyArrayObject *)__pyx_2); + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1897 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; 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 = 1897; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1898; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2099; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1899 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1899; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -6038,7 +5896,7 @@ 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 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 lognormal 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 pdf.\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 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; @@ -6065,35 +5923,33 @@ __pyx_v_omean = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_osigma = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2016 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2217 */ __pyx_v_fmean = PyFloat_AsDouble(__pyx_v_mean); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2017 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2218 */ __pyx_v_fsigma = PyFloat_AsDouble(__pyx_v_sigma); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2019 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2220 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2020 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2221 */ __pyx_1 = (__pyx_v_fsigma <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; goto __pyx_L1;} + __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_3, 0, __pyx_k120p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2022 */ - __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 = 2022; goto __pyx_L1;} + /* "/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; @@ -6101,66 +5957,64 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2024 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2225 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2026 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_mean,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2027 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_sigma,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2027; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2027; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; + __pyx_v_osigma = ((PyArrayObject *)__pyx_2); + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2028 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; 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 = 2028; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 2029; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2230; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2030 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -6210,32 +6064,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2042 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2243 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2044 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2245 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2045 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2246 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; goto __pyx_L1;} + __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_3, 0, __pyx_k122p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2047 */ - __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 = 2047; goto __pyx_L1;} + /* "/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; @@ -6243,59 +6095,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2049 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2250 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2051 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2052 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; 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 = 2052; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; 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 = 2052; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; goto __pyx_L1;} + 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 = 2052; 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 = 2052; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 2052; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2054 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2054; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -6351,52 +6201,48 @@ __pyx_v_omean = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2066 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2267 */ __pyx_v_fmean = PyFloat_AsDouble(__pyx_v_mean); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2067 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2268 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2068 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2269 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2069 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2270 */ __pyx_1 = (__pyx_v_fmean <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2070; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2070; goto __pyx_L1;} + __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_3, 0, __pyx_k124p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2070; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2070; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2071 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2272 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; goto __pyx_L1;} + __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_3, 0, __pyx_k125p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2073 */ - __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 = 2073; goto __pyx_L1;} + /* "/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; @@ -6404,102 +6250,98 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2075 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2276 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2076 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_mean,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2076; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2076; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2077 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2077; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2077; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; + __pyx_v_oscale = ((PyArrayObject *)__pyx_2); + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2078 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; 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 = 2078; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 2079; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; goto __pyx_L1;} goto __pyx_L5; } - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} + __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_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} + 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 = 2080; 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 = 2080; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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 = 2080; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2081; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2081; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2081; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2081; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2082 */ - __pyx_3 = __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_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2082; goto __pyx_L1;} - __pyx_r = __pyx_3; - __pyx_3 = 0; + /* "/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); @@ -6569,72 +6411,66 @@ __pyx_v_omode = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oright = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2097 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2298 */ __pyx_v_fleft = PyFloat_AsDouble(__pyx_v_left); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2098 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2299 */ __pyx_v_fright = PyFloat_AsDouble(__pyx_v_right); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2099 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2300 */ __pyx_v_fmode = PyFloat_AsDouble(__pyx_v_mode); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2100 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2301 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2101 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; goto __pyx_L1;} + __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_3, 0, __pyx_k128p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2103 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2104; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2104; goto __pyx_L1;} + __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_3, 0, __pyx_k129p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2104; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2104; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2105 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; goto __pyx_L1;} + __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_3, 0, __pyx_k130p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2107 */ - __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 = 2107; goto __pyx_L1;} + /* "/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; @@ -6642,146 +6478,140 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2110 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2311 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2111 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_left,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2111; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2112 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_mode,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2112; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); - Py_DECREF(((PyObject *)__pyx_v_omode)); - __pyx_v_omode = ((PyArrayObject *)__pyx_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2113 */ - __pyx_2 = PyArray_FROM_OTF(__pyx_v_right,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2113; goto __pyx_L1;} + /* "/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_oright)); - __pyx_v_oright = ((PyArrayObject *)__pyx_2); + Py_DECREF(((PyObject *)__pyx_v_omode)); + __pyx_v_omode = ((PyArrayObject *)__pyx_2); Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2115 */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} + /* "/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; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} + + /* "/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 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} + __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_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5); + __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_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} + 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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2116; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2116; goto __pyx_L1;} + __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_4, 0, __pyx_k131p); - __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2116; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_4); __pyx_4 = 0; __Pyx_Raise(__pyx_3, 0, 0); Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2116; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; goto __pyx_L1;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2117 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; goto __pyx_L1;} - __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; 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 = 2117; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_4, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; goto __pyx_L1;} + /* "/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_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; goto __pyx_L1;} + __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_2, 0, ((PyObject *)__pyx_v_omode)); + PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_omode)); Py_INCREF(((PyObject *)__pyx_v_oright)); - PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_oright)); - __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; goto __pyx_L1;} + 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; - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; 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 = 2117; 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 = 2117; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; goto __pyx_L1;} + __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_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2119 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; 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 = 2119; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} + /* "/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_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} + __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_2, 0, ((PyObject *)__pyx_v_oleft)); + PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_oleft)); Py_INCREF(((PyObject *)__pyx_v_oright)); - PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_oright)); - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + 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; - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5); + 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_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} + __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_3); __pyx_3 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} 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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; goto __pyx_L1;} + __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_4, 0, __pyx_k133p); - __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; goto __pyx_L1;} + 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_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2321; goto __pyx_L1;} goto __pyx_L8; } __pyx_L8:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2121 */ - __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 = 2121; goto __pyx_L1;} + /* "/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; @@ -6822,7 +6652,7 @@ 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 Binomial distribution of n trials and p probability of success.\n\n "; +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; @@ -6847,66 +6677,60 @@ __pyx_v_on = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2136 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2411 */ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2137 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2412 */ __pyx_v_ln = PyInt_AsLong(__pyx_v_n); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2138 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2413 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2139 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2414 */ __pyx_1 = (__pyx_v_ln <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; goto __pyx_L1;} + __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_3, 0, __pyx_k134p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2141 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2416 */ __pyx_1 = (__pyx_v_fp < 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2142; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2142; goto __pyx_L1;} + __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_3, 0, __pyx_k135p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2142; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2142; goto __pyx_L1;} + {__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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2144; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2144; goto __pyx_L1;} + __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_3, 0, __pyx_k136p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2144; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2144; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2145 */ - __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 = 2145; goto __pyx_L1;} + /* "/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; @@ -6914,144 +6738,138 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2147 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2422 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2149 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_n,NPY_LONG,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2149; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2150 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2151 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} + __pyx_v_op = ((PyArrayObject *)__pyx_2); 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 = 2151; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 2152; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2427; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2153 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} + /* "/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_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} + 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 = 2153; 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 = 2153; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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 = 2153; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2155 */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} - __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; 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 = 2155; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_greater); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} + /* "/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_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} + __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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3); - __pyx_3 = 0; - __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} + __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; - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; goto __pyx_L1;} + __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_5, 0, __pyx_k139p); - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - __Pyx_Raise(__pyx_2, 0, 0); + 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_filename = __pyx_f[0]; __pyx_lineno = 2156; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2157 */ - __pyx_4 = __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_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2157; goto __pyx_L1;} - __pyx_r = __pyx_4; - __pyx_4 = 0; + /* "/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); @@ -7113,66 +6931,60 @@ __pyx_v_on = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2171 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2446 */ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2172 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2447 */ __pyx_v_fn = PyFloat_AsDouble(__pyx_v_n); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2173 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2448 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2174 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2449 */ __pyx_1 = (__pyx_v_fn <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; goto __pyx_L1;} + __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_3, 0, __pyx_k140p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2450; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2176 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2451 */ __pyx_1 = (__pyx_v_fp < 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; goto __pyx_L1;} + __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_3, 0, __pyx_k141p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; goto __pyx_L1;} + {__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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; goto __pyx_L1;} + __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_3, 0, __pyx_k142p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2454; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2180 */ - __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 = 2180; goto __pyx_L1;} + /* "/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; @@ -7180,144 +6992,138 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2183 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2458 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2185 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_n,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2186 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2187 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} + __pyx_v_op = ((PyArrayObject *)__pyx_2); 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 = 2187; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2188; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2188; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2188; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 2188; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2463; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2189 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} + /* "/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_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} + 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 = 2189; 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 = 2189; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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 = 2189; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2190; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2190; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2190; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2190; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2191 */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} - __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; 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 = 2191; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_greater); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} + /* "/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_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} + __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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3); - __pyx_3 = 0; - __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} + __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; - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; goto __pyx_L1;} + __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_5, 0, __pyx_k145p); - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - __Pyx_Raise(__pyx_2, 0, 0); + 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_filename = __pyx_f[0]; __pyx_lineno = 2192; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2193 */ - __pyx_4 = __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_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2193; goto __pyx_L1;} - __pyx_r = __pyx_4; - __pyx_4 = 0; + /* "/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); @@ -7367,35 +7173,33 @@ Py_INCREF(__pyx_v_size); __pyx_v_olam = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2205 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2480 */ __pyx_v_flam = PyFloat_AsDouble(__pyx_v_lam); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2206 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2481 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2207 */ - __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2207; goto __pyx_L1;} - if (PyObject_Cmp(__pyx_v_lam, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2207; goto __pyx_L1;} + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; goto __pyx_L1;} + __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_3, 0, __pyx_k146p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2209 */ - __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 = 2209; goto __pyx_L1;} + /* "/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; @@ -7403,59 +7207,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2211 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2486 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2213 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_lam,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2213; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2214 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; 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 = 2214; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; 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 = 2214; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; goto __pyx_L1;} + 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 = 2214; 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 = 2214; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 2214; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2216 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2216; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -7502,32 +7304,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2297 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2572 */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2298 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2573 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2299 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; goto __pyx_L1;} + __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_3, 0, __pyx_k148p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2575; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2301 */ - __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 = 2301; goto __pyx_L1;} + /* "/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; @@ -7535,59 +7335,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2303 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2578 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2305 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2306 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; 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 = 2306; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyFloat_FromDouble(1.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; goto __pyx_L1;} + 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 = 2306; 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 = 2306; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 2306; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2308 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -7638,49 +7436,45 @@ Py_INCREF(__pyx_v_size); __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2358 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2633 */ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2359 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2634 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2360 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; goto __pyx_L1;} + __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_3, 0, __pyx_k150p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2362 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; goto __pyx_L1;} + __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_3, 0, __pyx_k151p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2364 */ - __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 = 2364; goto __pyx_L1;} + /* "/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; @@ -7688,98 +7482,94 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2366 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2641 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2369 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2369; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2370 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; 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 = 2370; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; 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 = 2370; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; goto __pyx_L1;} + 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 = 2370; 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 = 2370; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 2370; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2372 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; 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 = 2372; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_greater); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; goto __pyx_L1;} + /* "/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_5 = PyFloat_FromDouble(1.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; goto __pyx_L1;} - __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + 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_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; 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 = 2372; goto __pyx_L1;} + __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; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; goto __pyx_L1;} + __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_3, 0, __pyx_k153p); - __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __Pyx_Raise(__pyx_4, 0, 0); + 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_filename = __pyx_f[0]; __pyx_lineno = 2373; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2374 */ - __pyx_2 = __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_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2374; goto __pyx_L1;} - __pyx_r = __pyx_2; - __pyx_2 = 0; + /* "/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); @@ -7820,7 +7610,7 @@ 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 Hypergeometric distribution.\n\n Consider an urn with ngood \"good\" balls and nbad \"bad\" balls. If one\n were to draw nsample balls from the urn without replacement, then\n the hypergeometric distribution describes the distribution of \"good\"\n balls in the sample.\n\n "; +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; @@ -7851,302 +7641,286 @@ __pyx_v_onbad = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_onsample = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2391 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2738 */ __pyx_v_lngood = PyInt_AsLong(__pyx_v_ngood); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2392 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2739 */ __pyx_v_lnbad = PyInt_AsLong(__pyx_v_nbad); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2393 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2740 */ __pyx_v_lnsample = PyInt_AsLong(__pyx_v_nsample); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2394 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2741 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2395 */ - __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; goto __pyx_L1;} - if (PyObject_Cmp(__pyx_v_ngood, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; goto __pyx_L1;} + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; goto __pyx_L1;} + __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_3, 0, __pyx_k154p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2743; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2397 */ - __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2397; goto __pyx_L1;} - if (PyObject_Cmp(__pyx_v_nbad, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2397; goto __pyx_L1;} + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2398; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2398; goto __pyx_L1;} + __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_4, 0, __pyx_k155p); - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2398; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_4); __pyx_4 = 0; __Pyx_Raise(__pyx_2, 0, 0); Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2398; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2745; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2399 */ - __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2399; goto __pyx_L1;} - if (PyObject_Cmp(__pyx_v_nsample, __pyx_3, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2399; goto __pyx_L1;} + /* "/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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2400; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2400; goto __pyx_L1;} + __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(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2400; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 2400; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2747; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2401 */ - __pyx_4 = PyNumber_Add(__pyx_v_ngood, __pyx_v_nbad); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; goto __pyx_L1;} - if (PyObject_Cmp(__pyx_4, __pyx_v_nsample, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; goto __pyx_L1;} + /* "/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_4); __pyx_4 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2403 */ - __pyx_2 = __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_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2403; goto __pyx_L1;} - __pyx_r = __pyx_2; - __pyx_2 = 0; + /* "/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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2407 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2754 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2409 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_ngood,NPY_LONG,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3))); + /* "/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_3); - Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_v_ongood = ((PyArrayObject *)__pyx_2); + Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2410 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_nbad,NPY_LONG,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2410; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; + __pyx_v_onbad = ((PyArrayObject *)__pyx_3); + Py_DECREF(__pyx_3); __pyx_3 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2411 */ - __pyx_2 = PyArray_FROM_OTF(__pyx_v_nsample,NPY_LONG,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2411; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2412 */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} + /* "/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_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} + __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_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + 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_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); - __pyx_2 = 0; - __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} + __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; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} + __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_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; goto __pyx_L1;} + __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_4, 0, __pyx_k158p); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __Pyx_Raise(__pyx_3, 0, 0); + 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_filename = __pyx_f[0]; __pyx_lineno = 2413; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2414 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_4, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} + /* "/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_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} + __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_4, 0, ((PyObject *)__pyx_v_onbad)); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; 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 = 2414; goto __pyx_L1;} + __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; - __pyx_1 = PyObject_IsTrue(__pyx_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; if (__pyx_1) { - __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; goto __pyx_L1;} + __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_2, 0, __pyx_k159p); - __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; goto __pyx_L1;} + 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; - 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;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; goto __pyx_L1;} goto __pyx_L8; } __pyx_L8:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2416 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; goto __pyx_L1;} - __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; 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 = 2416; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; goto __pyx_L1;} + /* "/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 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; goto __pyx_L1;} - __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; goto __pyx_L1;} + __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_2, 0, ((PyObject *)__pyx_v_onsample)); - 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 = 2416; 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 = 2416; 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 = 2416; goto __pyx_L1;} + 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; - __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; 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 = 2763; goto __pyx_L1;} + Py_DECREF(__pyx_4); __pyx_4 = 0; if (__pyx_1) { - __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2417; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2417; goto __pyx_L1;} + __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_5, 0, __pyx_k160p); - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2417; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; + 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 = 2417; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; goto __pyx_L1;} goto __pyx_L9; } __pyx_L9:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2418 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; 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 = 2418; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} + /* "/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 = 2418; goto __pyx_L1;} - __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} + __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_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} + __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_2, 0, ((PyObject *)__pyx_v_ongood)); + PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_ongood)); Py_INCREF(((PyObject *)__pyx_v_onbad)); - PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_onbad)); - __pyx_6 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + 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; - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_5, 0, __pyx_6); + 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_5, 1, ((PyObject *)__pyx_v_onsample)); + PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_onsample)); __pyx_6 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} + __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_5); __pyx_5 = 0; - __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_6, 0, __pyx_2); - __pyx_2 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} + 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 = 2418; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2420 */ - __pyx_6 = __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_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2420; goto __pyx_L1;} - __pyx_r = __pyx_6; - __pyx_6 = 0; + /* "/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); @@ -8184,7 +7958,7 @@ 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 Logarithmic series distribution.\n\n "; +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; @@ -8204,49 +7978,45 @@ Py_INCREF(__pyx_v_size); __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2433 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2847 */ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2434 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2848 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2435 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; goto __pyx_L1;} + __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_3, 0, __pyx_k162p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2437 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2438; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2438; goto __pyx_L1;} + __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_3, 0, __pyx_k163p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2438; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2438; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2439 */ - __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 = 2439; goto __pyx_L1;} + /* "/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; @@ -8254,98 +8024,94 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2441 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2855 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2443 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2444 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; 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 = 2444; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; 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 = 2444; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; goto __pyx_L1;} + 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 = 2444; 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 = 2444; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 2444; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2446 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; 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 = 2446; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_greater_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; goto __pyx_L1;} + /* "/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_5 = PyFloat_FromDouble(1.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; goto __pyx_L1;} - __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + 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_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; 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 = 2446; goto __pyx_L1;} + __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; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; goto __pyx_L1;} + __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_3, 0, __pyx_k165p); - __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __Pyx_Raise(__pyx_4, 0, 0); + 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_filename = __pyx_f[0]; __pyx_lineno = 2447; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2448 */ - __pyx_2 = __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_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2448; goto __pyx_L1;} - __pyx_r = __pyx_2; - __pyx_2 = 0; + /* "/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); @@ -8367,14 +8133,12 @@ static PyObject *__pyx_n_array; static PyObject *__pyx_n_shape; -static PyObject *__pyx_n_list; static PyObject *__pyx_n_append; static PyObject *__pyx_n_multiply; static PyObject *__pyx_n_reduce; static PyObject *__pyx_n_svd; static PyObject *__pyx_n_dot; static PyObject *__pyx_n_sqrt; -static PyObject *__pyx_n_tuple; static PyObject *__pyx_k166p; static PyObject *__pyx_k167p; @@ -8421,38 +8185,38 @@ __pyx_v_s = Py_None; Py_INCREF(Py_None); __pyx_v_v = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2544 */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; goto __pyx_L1;} + /* "/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 = 2544; goto __pyx_L1;} + __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 = 2544; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2545 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; goto __pyx_L1;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; goto __pyx_L1;} + /* "/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 = 2545; goto __pyx_L1;} + __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 = 2545; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2546 */ + /* "/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 = 2547; goto __pyx_L1;} + __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; @@ -8465,98 +8229,82 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2550 */ - __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; goto __pyx_L1;} - __pyx_5 = PyObject_Length(__pyx_3); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; goto __pyx_L1;} + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; goto __pyx_L1;} - __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; goto __pyx_L1;} + __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_1, 0, __pyx_k166p); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; goto __pyx_L1;} + 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_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2552 */ - __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - __pyx_5 = PyObject_Length(__pyx_2); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + /* "/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_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __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; - __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - __pyx_6 = PyObject_GetItem(__pyx_1, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - if (PyObject_Cmp(__pyx_2, __pyx_6, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_6); __pyx_6 = 0; } if (__pyx_4) { - __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2554 */ - __pyx_6 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} - __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} - __pyx_3 = PyObject_GetItem(__pyx_6, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} - __pyx_6 = PyInt_FromLong(0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} - __pyx_1 = PyObject_GetItem(__pyx_2, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} + /* "/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; - Py_DECREF(__pyx_6); __pyx_6 = 0; - if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} + __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_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_4) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; goto __pyx_L1;} - __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; goto __pyx_L1;} + __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_6, 0, __pyx_k168p); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_6); __pyx_6 = 0; + 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 = 2555; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2969; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2557 */ - __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; goto __pyx_L1;} - __pyx_4 = PyObject_IsInstance(__pyx_v_shape,__pyx_1); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + /* "/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 = 2558; goto __pyx_L1;} + __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); @@ -8566,174 +8314,166 @@ } __pyx_L6:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2559 */ - __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; goto __pyx_L1;} - __pyx_3 = PySequence_GetSlice(__pyx_v_shape, 0, PY_SSIZE_T_MAX); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; goto __pyx_L1;} - __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3); - __pyx_3 = 0; - __pyx_2 = PyObject_CallObject(__pyx_6, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; goto __pyx_L1;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2560 */ - __pyx_3 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; goto __pyx_L1;} - __pyx_6 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; goto __pyx_L1;} - __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_6, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; goto __pyx_L1;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; 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 = 2560; goto __pyx_L1;} + /* "/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; - Py_DECREF(__pyx_6); __pyx_6 = 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2564 */ - __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} - __pyx_6 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} + /* "/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_1 = PyObject_GetAttr(__pyx_6, __pyx_n_reduce); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} + __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_3, 0, __pyx_v_final_shape); - __pyx_6 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + 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; - __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_6); - __pyx_6 = 0; - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; 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 = 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_3; - __pyx_3 = 0; + __pyx_v_x = __pyx_2; + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2565 */ - __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_6, __pyx_n_multiply); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} + /* "/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_1 = PyObject_GetAttr(__pyx_2, __pyx_n_reduce); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_5 = PyObject_Length(__pyx_v_final_shape); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} - __pyx_3 = PySequence_GetSlice(__pyx_v_final_shape, 0, (__pyx_5 - 1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} - __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_6, 0, __pyx_3); - __pyx_3 = 0; - __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} + __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; - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; goto __pyx_L1;} - __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; goto __pyx_L1;} - __pyx_6 = PyObject_GetItem(__pyx_3, __pyx_1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_6); + __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_6 = 0; - if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2574 */ - __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; goto __pyx_L1;} + /* "/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_1, 0, __pyx_n_svd); - __pyx_2 = __Pyx_Import(__pyx_k169p, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_6 = PyObject_GetAttr(__pyx_2, __pyx_n_svd); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; goto __pyx_L1;} - Py_DECREF(__pyx_v_svd); - __pyx_v_svd = __pyx_6; - __pyx_6 = 0; + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2576 */ - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} + /* "/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_3, 0, __pyx_v_cov); - __pyx_1 = PyObject_CallObject(__pyx_v_svd, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_2 = PyObject_GetIter(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_6 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} + 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_6; - __pyx_6 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} - Py_DECREF(__pyx_v_s); - __pyx_v_s = __pyx_3; + __pyx_v_u = __pyx_3; __pyx_3 = 0; - __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} + __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_1; - __pyx_1 = 0; - if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2577 */ - __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_6, __pyx_n_dot); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_sqrt); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} + __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; - __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} - Py_INCREF(__pyx_v_s); - PyTuple_SET_ITEM(__pyx_6, 0, __pyx_v_s); - __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} + + /* "/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; - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_2 = PyNumber_Multiply(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} + __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; - __pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_6, 0, __pyx_2); - Py_INCREF(__pyx_v_v); - PyTuple_SET_ITEM(__pyx_6, 1, __pyx_v_v); - __pyx_2 = 0; - __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} 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_1; - __pyx_1 = 0; + __pyx_v_x = __pyx_2; + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2580 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_6 = PyTuple_New(3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; goto __pyx_L1;} + /* "/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_6, 0, __pyx_v_mean); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_mean); Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_6, 1, __pyx_v_x); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_x); Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_6, 2, __pyx_v_x); - __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + 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_1); __pyx_1 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2581 */ - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;} + /* "/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_3, 0, __pyx_v_final_shape); - __pyx_6 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2582 */ + /* "/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; @@ -8803,42 +8543,40 @@ __pyx_v_shape = Py_None; Py_INCREF(Py_None); __pyx_v_multin = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2643 */ - __pyx_1 = PyObject_Length(__pyx_v_pvals); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2643; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2644 */ - __pyx_2 = PyArray_ContiguousFromObject(__pyx_v_pvals,NPY_DOUBLE,1,1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2645 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3059 */ __pyx_v_pix = ((double *)arrayObject_parr->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2647 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; goto __pyx_L1;} + __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_4, 0, __pyx_k171p); - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; goto __pyx_L1;} + 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_Raise(__pyx_5, 0, 0); - Py_DECREF(__pyx_5); __pyx_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; goto __pyx_L1;} goto __pyx_L2; } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2650 */ + /* "/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 = 2651; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2651; goto __pyx_L1;} + __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); @@ -8846,20 +8584,16 @@ __pyx_4 = 0; goto __pyx_L3; } - __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; goto __pyx_L1;} + __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(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; goto __pyx_L1;} - __pyx_3 = __pyx_4 == __pyx_5; + __pyx_3 = __pyx_4 == ((PyObject *)(&PyInt_Type)); Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; if (__pyx_3) { - __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; goto __pyx_L1;} + __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); @@ -8870,68 +8604,67 @@ goto __pyx_L3; } /*else*/ { - __pyx_5 = PyInt_FromLong(__pyx_v_d); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2655; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2655; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5); - __pyx_5 = 0; - __pyx_4 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2655; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __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_4; - __pyx_4 = 0; + __pyx_v_shape = __pyx_2; + __pyx_2 = 0; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2657 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; goto __pyx_L1;} + /* "/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_5, 0, __pyx_v_shape); - PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; goto __pyx_L1;} + 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_5); __pyx_5 = 0; + Py_DECREF(__pyx_4); __pyx_4 = 0; Py_DECREF(__pyx_v_multin); - __pyx_v_multin = __pyx_4; - __pyx_4 = 0; + __pyx_v_multin = __pyx_5; + __pyx_5 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2658 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2659 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3073 */ __pyx_v_mnix = ((long *)arrayObject_mnarr->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2660 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3074 */ __pyx_v_i = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2661 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2662 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3076 */ __pyx_v_Sum = 1.0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2663 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3077 */ __pyx_v_dn = __pyx_v_n; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2664 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2665 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2666 */ + /* "/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)])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2667 */ + /* "/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; @@ -8939,12 +8672,12 @@ } __pyx_L8:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2669 */ + /* "/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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2670 */ + /* "/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; @@ -8952,11 +8685,11 @@ } __pyx_L9:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2673 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3087 */ __pyx_v_i = (__pyx_v_i + __pyx_v_d); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2675 */ + /* "/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; @@ -9014,25 +8747,25 @@ __pyx_v_shape = Py_None; Py_INCREF(Py_None); __pyx_v_diric = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2741 */ - __pyx_1 = PyObject_Length(__pyx_v_alpha); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2742 */ - __pyx_2 = PyArray_ContiguousFromObject(__pyx_v_alpha,NPY_DOUBLE,1,1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2743 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3157 */ __pyx_v_alpha_data = ((double *)__pyx_v_alpha_arr->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2745 */ + /* "/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 = 2746; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2746; goto __pyx_L1;} + __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); @@ -9040,106 +8773,102 @@ __pyx_4 = 0; goto __pyx_L2; } - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2747; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2747; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2747; goto __pyx_L1;} + 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; - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2747; goto __pyx_L1;} - __pyx_3 = __pyx_5 == __pyx_2; - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_3) { - __pyx_4 = PyInt_FromLong(__pyx_v_k); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; goto __pyx_L1;} + __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_5, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4); - __pyx_4 = 0; + 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_5; - __pyx_5 = 0; + __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 = 2750; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2750; goto __pyx_L1;} + __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_5 = PyNumber_Add(__pyx_v_size, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2750; goto __pyx_L1;} + __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_5; - __pyx_5 = 0; + __pyx_v_shape = __pyx_2; + __pyx_2 = 0; } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2752 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_zeros); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; 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 = 2752; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_n_float64); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; 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 = 2752; goto __pyx_L1;} + /* "/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_5, 0, __pyx_v_shape); - 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 = 2752; goto __pyx_L1;} + 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_5); __pyx_5 = 0; Py_DECREF(__pyx_v_diric); - __pyx_v_diric = __pyx_2; - __pyx_2 = 0; + __pyx_v_diric = __pyx_5; + __pyx_5 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2753 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2754 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3168 */ __pyx_v_val_data = ((double *)__pyx_v_val_arr->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2756 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3170 */ __pyx_v_i = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2757 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3171 */ __pyx_v_totsize = PyArray_SIZE(__pyx_v_val_arr); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2758 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2759 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3173 */ __pyx_v_acc = 0.0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2760 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2761 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2762 */ + /* "/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)])); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2763 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3177 */ __pyx_v_invacc = (1 / __pyx_v_acc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2764 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2766 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3180 */ __pyx_v_i = (__pyx_v_i + __pyx_v_k); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2768 */ + /* "/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; @@ -9184,28 +8913,25 @@ Py_INCREF(__pyx_v_self); Py_INCREF(__pyx_v_x); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2781 */ - __pyx_1 = PyObject_Length(__pyx_v_x); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2781; goto __pyx_L1;} + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2782 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3196 */ /*try:*/ { - __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; goto __pyx_L2;} - __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; goto __pyx_L2;} + __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_1 = PyObject_Length(__pyx_3); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; goto __pyx_L2;} - Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_v_j = __pyx_1; } goto __pyx_L3; __pyx_L2:; Py_XDECREF(__pyx_2); __pyx_2 = 0; - Py_XDECREF(__pyx_3); __pyx_3 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2784 */ + /* "/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 = 2784; goto __pyx_L1;} + 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; @@ -9214,82 +8940,64 @@ } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2787 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2790 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2791 */ - __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} - __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} + /* "/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; - __pyx_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} - if (PyObject_SetItem(__pyx_v_x, __pyx_4, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; 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 = 3205; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} - if (PyObject_SetItem(__pyx_v_x, __pyx_3, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2792 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3206 */ __pyx_v_i = (__pyx_v_i - 1); } goto __pyx_L4; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2795 */ - __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; goto __pyx_L1;} + /* "/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_5 = PyObject_HasAttr(__pyx_2,__pyx_n_copy); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_v_copy = __pyx_5; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2796 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2798 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2799 */ - __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - __pyx_4 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} + /* "/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 = PyObject_GetAttr(__pyx_4, __pyx_n_copy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} + __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_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} + __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; - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_copy); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} + 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; - __pyx_2 = PyObject_CallObject(__pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - if (PyObject_SetItem(__pyx_v_x, __pyx_4, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - if (PyObject_SetItem(__pyx_v_x, __pyx_3, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2800 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3214 */ __pyx_v_i = (__pyx_v_i - 1); } goto __pyx_L7; @@ -9299,30 +9007,22 @@ __pyx_5 = (__pyx_v_i > 0); if (!__pyx_5) break; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2803 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2804 */ - __pyx_4 = PyInt_FromLong(__pyx_v_j); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_3 = PySequence_GetSlice(__pyx_2, 0, PY_SSIZE_T_MAX); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} + /* "/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; - __pyx_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} + 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; - __pyx_4 = PySequence_GetSlice(__pyx_2, 0, PY_SSIZE_T_MAX); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; 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 = 3218; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - if (PyObject_SetItem(__pyx_v_x, __pyx_3, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2805 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3219 */ __pyx_v_i = (__pyx_v_i - 1); } } @@ -9354,68 +9054,67 @@ PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - int __pyx_4; + 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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2834 */ - __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; goto __pyx_L1;} - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_integer); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; 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 = 2834; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_3); - __pyx_1 = 0; - __pyx_3 = 0; - __pyx_4 = PyObject_IsInstance(__pyx_v_x,__pyx_2); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (__pyx_4) { - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_arange); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; goto __pyx_L1;} + /* "/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_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_1; - __pyx_1 = 0; + __pyx_v_arr = __pyx_4; + __pyx_4 = 0; goto __pyx_L2; } /*else*/ { - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; goto __pyx_L1;} + __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_1, 0, __pyx_v_x); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; goto __pyx_L1;} + 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_1); __pyx_1 = 0; + Py_DECREF(__pyx_4); __pyx_4 = 0; Py_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_3; - __pyx_3 = 0; + __pyx_v_arr = __pyx_1; + __pyx_1 = 0; } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2838 */ - __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2838; goto __pyx_L1;} - __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2838; goto __pyx_L1;} + /* "/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_1, 0, __pyx_v_arr); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2838; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_3); __pyx_3 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2839 */ + /* "/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; @@ -9425,7 +9124,7 @@ __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); __Pyx_AddTraceback("mtrand.RandomState.permutation"); __pyx_r = 0; __pyx_L0:; @@ -9437,8 +9136,6 @@ static __Pyx_InternTabEntry __pyx_intern_tab[] = { {&__pyx_n_MT19937, "MT19937"}, - {&__pyx_n_TypeError, "TypeError"}, - {&__pyx_n_ValueError, "ValueError"}, {&__pyx_n___RandomState_ctor, "__RandomState_ctor"}, {&__pyx_n__rand, "_rand"}, {&__pyx_n_add, "add"}, @@ -9466,12 +9163,10 @@ {&__pyx_n_greater_equal, "greater_equal"}, {&__pyx_n_gumbel, "gumbel"}, {&__pyx_n_hypergeometric, "hypergeometric"}, - {&__pyx_n_int, "int"}, {&__pyx_n_integer, "integer"}, {&__pyx_n_laplace, "laplace"}, {&__pyx_n_less, "less"}, {&__pyx_n_less_equal, "less_equal"}, - {&__pyx_n_list, "list"}, {&__pyx_n_logistic, "logistic"}, {&__pyx_n_lognormal, "lognormal"}, {&__pyx_n_logseries, "logseries"}, @@ -9510,8 +9205,6 @@ {&__pyx_n_subtract, "subtract"}, {&__pyx_n_svd, "svd"}, {&__pyx_n_triangular, "triangular"}, - {&__pyx_n_tuple, "tuple"}, - {&__pyx_n_type, "type"}, {&__pyx_n_uint, "uint"}, {&__pyx_n_uint32, "uint32"}, {&__pyx_n_uniform, "uniform"}, @@ -9653,14 +9346,6 @@ (*o->ob_type->tp_free)(o); } -static int __pyx_tp_traverse_6mtrand_RandomState(PyObject *o, visitproc v, void *a) { - return 0; -} - -static int __pyx_tp_clear_6mtrand_RandomState(PyObject *o) { - return 0; -} - static struct PyMethodDef __pyx_methods_6mtrand_RandomState[] = { {"seed", (PyCFunction)__pyx_f_6mtrand_11RandomState_seed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_seed}, {"get_state", (PyCFunction)__pyx_f_6mtrand_11RandomState_get_state, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_get_state}, @@ -9806,10 +9491,10 @@ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_RandomState, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*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 : {None, int, array-like}\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*/ - __pyx_tp_traverse_6mtrand_RandomState, /*tp_traverse*/ - __pyx_tp_clear_6mtrand_RandomState, /*tp_clear*/ + 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*/ @@ -9877,37 +9562,37 @@ 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":121 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":121 */ import_array(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":123 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":546 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":546 */ Py_INCREF(Py_None); __pyx_k2 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":556 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":556 */ Py_INCREF(Py_None); __pyx_k3 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":646 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":646 */ Py_INCREF(Py_None); __pyx_k4 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":655 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":655 */ Py_INCREF(Py_None); __pyx_k5 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":683 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":747 */ + /* "/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; @@ -9917,17 +9602,17 @@ Py_INCREF(Py_None); __pyx_k10 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":895 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":910 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":910 */ Py_INCREF(Py_None); __pyx_k13 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":919 */ + /* "/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; @@ -9937,495 +9622,495 @@ Py_INCREF(Py_None); __pyx_k16 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1019 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1019 */ Py_INCREF(Py_None); __pyx_k17 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1078 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1128 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1128 */ Py_INCREF(Py_None); __pyx_k20 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1137 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1137 */ Py_INCREF(Py_None); __pyx_k21 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1159 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1187 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1250 */ Py_INCREF(Py_None); __pyx_k24 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1216 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1353 */ Py_INCREF(Py_None); __pyx_k25 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1254 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1391 */ Py_INCREF(Py_None); __pyx_k26 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1334 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1471 */ Py_INCREF(Py_None); __pyx_k27 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1376 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1513 */ Py_INCREF(Py_None); __pyx_k28 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1385 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1522 */ Py_INCREF(Py_None); __pyx_k29 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1408 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1545 */ Py_INCREF(Py_None); __pyx_k30 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1503 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1640 */ Py_INCREF(Py_None); __pyx_k31 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1592 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1729 */ Py_INCREF(Py_None); __pyx_k32 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1691 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1828 */ Py_INCREF(Py_None); __pyx_k33 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1714 */ - __pyx_7 = PyFloat_FromDouble(0.0); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; goto __pyx_L1;} + /* "/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 = 1714; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1753 */ - __pyx_9 = PyFloat_FromDouble(0.0); if (!__pyx_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; goto __pyx_L1;} + /* "/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 = 1753; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1877 */ - __pyx_11 = PyFloat_FromDouble(0.0); if (!__pyx_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1877; goto __pyx_L1;} + /* "/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 = 1877; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1901 */ - __pyx_13 = PyFloat_FromDouble(0.0); if (!__pyx_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; goto __pyx_L1;} + /* "/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 = 1901; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2032 */ - __pyx_15 = PyFloat_FromDouble(1.0); if (!__pyx_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2032; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2056 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2257 */ Py_INCREF(Py_None); __pyx_k48 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2086 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2287 */ Py_INCREF(Py_None); __pyx_k49 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2125 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2326 */ Py_INCREF(Py_None); __pyx_k50 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2159 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2434 */ Py_INCREF(Py_None); __pyx_k51 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2196 */ - __pyx_16 = PyFloat_FromDouble(1.0); if (!__pyx_16) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2218 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2493 */ Py_INCREF(Py_None); __pyx_k54 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2310 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2585 */ Py_INCREF(Py_None); __pyx_k55 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2376 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2651 */ Py_INCREF(Py_None); __pyx_k56 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2423 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2770 */ Py_INCREF(Py_None); __pyx_k57 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2451 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2865 */ Py_INCREF(Py_None); __pyx_k58 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2584 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2998 */ Py_INCREF(Py_None); __pyx_k59 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2677 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3091 */ Py_INCREF(Py_None); __pyx_k60 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2841 */ - __pyx_17 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), 0); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2841; goto __pyx_L1;} - if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_17) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2841; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2842 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2842; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_seed); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2842; goto __pyx_L1;} + /* "/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 = 2842; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2843 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2843; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_get_state); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2843; goto __pyx_L1;} + /* "/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 = 2843; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2844 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_set_state); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; goto __pyx_L1;} + /* "/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 = 2844; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2845 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2845; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_random_sample); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2845; goto __pyx_L1;} + /* "/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 = 2845; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2846 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2846; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_randint); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2846; goto __pyx_L1;} + /* "/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 = 2846; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2847 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2847; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_bytes); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2847; goto __pyx_L1;} + /* "/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 = 2847; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2848 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2848; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_uniform); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2848; goto __pyx_L1;} + /* "/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 = 2848; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2849 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_rand); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; goto __pyx_L1;} + /* "/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 = 2849; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2850 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_randn); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; goto __pyx_L1;} + /* "/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 = 2850; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2851 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2851; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_random_integers); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2851; goto __pyx_L1;} + /* "/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 = 2851; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2852 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; goto __pyx_L1;} + /* "/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 = 2852; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2853 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; goto __pyx_L1;} + /* "/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 = 2853; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2854 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_beta); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; goto __pyx_L1;} + /* "/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 = 2854; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2855 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_exponential); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; goto __pyx_L1;} + /* "/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 = 2855; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2856 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_exponential); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; goto __pyx_L1;} + /* "/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 = 2856; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2857 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2857; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_gamma); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2857; goto __pyx_L1;} + /* "/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 = 2857; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2858 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_gamma); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;} + /* "/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 = 2858; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2859 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_f); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; goto __pyx_L1;} + /* "/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 = 2859; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2860 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_noncentral_f); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; goto __pyx_L1;} + /* "/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 = 2860; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2861 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_chisquare); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; goto __pyx_L1;} + /* "/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 = 2861; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2862 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_noncentral_chisquare); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; goto __pyx_L1;} + /* "/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 = 2862; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2863 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_cauchy); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; goto __pyx_L1;} + /* "/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 = 2863; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2864 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_t); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; goto __pyx_L1;} + /* "/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 = 2864; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2865 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2865; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_vonmises); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2865; goto __pyx_L1;} + /* "/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 = 2865; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2866 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_pareto); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; goto __pyx_L1;} + /* "/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 = 2866; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2867 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_weibull); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; goto __pyx_L1;} + /* "/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 = 2867; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2868 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_power); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; goto __pyx_L1;} + /* "/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 = 2868; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2869 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2869; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_laplace); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2869; goto __pyx_L1;} + /* "/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 = 2869; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2870 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2870; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_gumbel); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2870; goto __pyx_L1;} + /* "/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 = 2870; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2871 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2871; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_logistic); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2871; goto __pyx_L1;} + /* "/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 = 2871; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2872 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2872; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_lognormal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2872; goto __pyx_L1;} + /* "/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 = 2872; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2873 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2873; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_rayleigh); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2873; goto __pyx_L1;} + /* "/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 = 2873; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2874 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_wald); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; goto __pyx_L1;} + /* "/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 = 2874; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2875 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2875; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_triangular); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2875; goto __pyx_L1;} + /* "/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 = 2875; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2877 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2877; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_binomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2877; goto __pyx_L1;} + /* "/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 = 2877; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2878 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_negative_binomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; goto __pyx_L1;} + /* "/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 = 2878; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2879 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2879; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_poisson); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2879; goto __pyx_L1;} + /* "/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 = 2879; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2880 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_zipf); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; goto __pyx_L1;} + /* "/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 = 2880; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2881 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2881; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_geometric); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2881; goto __pyx_L1;} + /* "/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 = 2881; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2882 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2882; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_hypergeometric); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2882; goto __pyx_L1;} + /* "/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 = 2882; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2883 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_logseries); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; goto __pyx_L1;} + /* "/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 = 2883; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2885 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_multivariate_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; goto __pyx_L1;} + /* "/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 = 2885; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2886 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_multinomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; goto __pyx_L1;} + /* "/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 = 2886; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2887 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_dirichlet); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; goto __pyx_L1;} + /* "/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 = 2887; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2889 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_shuffle); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; goto __pyx_L1;} + /* "/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 = 2889; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2890 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2890; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_permutation); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2890; goto __pyx_L1;} + /* "/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 = 2890; goto __pyx_L1;} + 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:; From numpy-svn at scipy.org Mon Oct 27 20:38:55 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 27 Oct 2008 19:38:55 -0500 (CDT) Subject: [Numpy-svn] r5965 - in branches/1.2.x/numpy: core core/code_generators lib random/mtrand Message-ID: <20081028003855.2E1B3C7C00D@scipy.org> Author: ptvirtan Date: 2008-10-27 19:38:35 -0500 (Mon, 27 Oct 2008) New Revision: 5965 Modified: branches/1.2.x/numpy/core/code_generators/docstrings.py branches/1.2.x/numpy/core/defmatrix.py branches/1.2.x/numpy/core/fromnumeric.py branches/1.2.x/numpy/core/numeric.py branches/1.2.x/numpy/lib/function_base.py branches/1.2.x/numpy/lib/polynomial.py branches/1.2.x/numpy/lib/twodim_base.py branches/1.2.x/numpy/random/mtrand/mtrand.pyx Log: 1.2.x: Backport r5962: improved docstrings from trunk (part 1) Modified: branches/1.2.x/numpy/core/code_generators/docstrings.py =================================================================== --- branches/1.2.x/numpy/core/code_generators/docstrings.py 2008-10-28 00:24:27 UTC (rev 5964) +++ branches/1.2.x/numpy/core/code_generators/docstrings.py 2008-10-28 00:38:35 UTC (rev 5965) @@ -11,22 +11,20 @@ add_newdoc('numpy.core.umath', 'absolute', """ - Calculate the absolute value elementwise. + Calculate the absolute value element-wise. Parameters ---------- x : array_like - An array-like sequence of values or a scalar. + Input array. Returns ------- - res : {ndarray, scalar} + res : ndarray An ndarray containing the absolute value of each element in `x`. For complex input, ``a + ib``, the absolute value is :math:`\\sqrt{ a^2 + b^2 }`. - Returns a scalar for scalar input. - Examples -------- >>> x = np.array([-1.2, 1.2]) @@ -1126,6 +1124,13 @@ >>> np.greater([4,2],[2,2]) array([ True, False], dtype=bool) + If the inputs are ndarrays, then np.greater is equivalent to '>'. + + >>> a = np.array([4,2]) + >>> b = np.array([2,2]) + >>> a > b + array([ True, False], dtype=bool) + """) add_newdoc('numpy.core.umath', 'greater_equal', @@ -2104,14 +2109,15 @@ Returns ------- y : ndarray - The square-root of each element in `x`. If any element in `x` + An array of the same shape as `x`, containing the square-root of + each element in `x`. If any element in `x` is complex, a complex array is returned. If all of the elements - of `x` are real, negative elements will return numpy.nan elements. + of `x` are real, negative elements return numpy.nan elements. See Also -------- numpy.lib.scimath.sqrt - A version which will return complex numbers when given negative reals. + A version which returns complex numbers when given negative reals. Notes ----- Modified: branches/1.2.x/numpy/core/defmatrix.py =================================================================== --- branches/1.2.x/numpy/core/defmatrix.py 2008-10-28 00:24:27 UTC (rev 5964) +++ branches/1.2.x/numpy/core/defmatrix.py 2008-10-28 00:38:35 UTC (rev 5965) @@ -590,6 +590,11 @@ Input data. Variables names in the current scope may be referenced, even if `obj` is a string. + Returns + ------- + out : matrix + Returns a matrix object, which is a specialized 2-D array. + See Also -------- matrix Modified: branches/1.2.x/numpy/core/fromnumeric.py =================================================================== --- branches/1.2.x/numpy/core/fromnumeric.py 2008-10-28 00:24:27 UTC (rev 5964) +++ branches/1.2.x/numpy/core/fromnumeric.py 2008-10-28 00:38:35 UTC (rev 5965) @@ -294,7 +294,7 @@ Returns ------- a_swapped : ndarray - If `a` is an ndarray, then a view on `a` is returned, otherwise + If `a` is an ndarray, then a view of `a` is returned; otherwise a new array is created. Examples @@ -1176,11 +1176,9 @@ """ Return the product of array elements over a given axis. - Refer to `numpy.prod` for full documentation. - See Also -------- - prod : equivalent function + prod : equivalent function; see for details. """ try: @@ -1390,11 +1388,10 @@ """ Return the cumulative product over the given axis. - See `cumprod` for full documentation. See Also -------- - cumprod + cumprod : equivalent function; see for details. """ try: @@ -1449,7 +1446,7 @@ def amax(a, axis=None, out=None): """ - Return the maximum along a given axis. + Return the maximum along an axis. Parameters ---------- @@ -1463,19 +1460,19 @@ Returns ------- - amax : {ndarray, scalar} + amax : ndarray A new array or a scalar with the result, or a reference to `out` if it was specified. Examples -------- - >>> x = np.arange(4).reshape((2,2)) - >>> x + >>> a = np.arange(4).reshape((2,2)) + >>> a array([[0, 1], [2, 3]]) - >>> np.amax(x,0) + >>> np.amax(a, axis=0) array([2, 3]) - >>> np.amax(x,1) + >>> np.amax(a, axis=1) array([1, 3]) """ @@ -1488,7 +1485,7 @@ def amin(a, axis=None, out=None): """ - Return the minimum along a given axis. + Return the minimum along an axis. Parameters ---------- @@ -1502,19 +1499,21 @@ Returns ------- - amin : {ndarray, scalar} + amin : ndarray A new array or a scalar with the result, or a reference to `out` if it was specified. Examples -------- - >>> x = np.arange(4).reshape((2,2)) - >>> x + >>> a = np.arange(4).reshape((2,2)) + >>> a array([[0, 1], [2, 3]]) - >>> np.amin(x,0) + >>> np.amin(a) # Minimum of the flattened array + 0 + >>> np.amin(a, axis=0) # Minima along the first axis array([0, 1]) - >>> np.amin(x,1) + >>> np.amin(a, axis=1) # Minima along the second axis array([0, 2]) """ @@ -1638,7 +1637,7 @@ Parameters ---------- - a : array-like + a : array_like Input array. axis : int, optional Axis along which the cumulative product is computed. By default the @@ -1656,7 +1655,7 @@ Returns ------- - cumprod : ndarray. + cumprod : ndarray A new array holding the result is returned unless `out` is specified, in which case a reference to out is returned. @@ -1923,21 +1922,21 @@ a : array_like Array containing numbers whose mean is desired. If `a` is not an array, a conversion is attempted. - axis : {None, int}, optional + axis : int, optional Axis along which the means are computed. The default is to compute the mean of the flattened array. - dtype : {None, dtype}, optional - Type to use in computing the mean. For integer inputs the default - is float64; for floating point inputs it is the same as the input + dtype : dtype, optional + Type to use in computing the mean. For integer inputs, the default + is float64; for floating point, inputs it is the same as the input dtype. - out : {None, ndarray}, optional + out : ndarray, optional Alternative output array in which to place the result. It must have the same shape as the expected output but the type will be cast if necessary. Returns ------- - mean : {ndarray, scalar}, see dtype parameter above + mean : ndarray, see dtype parameter above If `out=None`, returns a new array containing the mean values, otherwise a reference to the output array is returned. @@ -2048,27 +2047,27 @@ Parameters ---------- a : array_like - Array containing numbers whose variance is desired. If a is not an + Array containing numbers whose variance is desired. If `a` is not an array, a conversion is attempted. axis : int, optional Axis along which the variance is computed. The default is to compute the variance of the flattened array. dtype : dtype, optional Type to use in computing the variance. For arrays of integer type - the default is float32, for arrays of float types it is the same as + the default is float32; for arrays of float types it is the same as the array type. out : ndarray, optional Alternative output array in which to place the result. It must have - the same shape as the expected output but the type will be cast if + the same shape as the expected output but the type is cast if necessary. ddof : positive int,optional - Means Delta Degrees of Freedom. The divisor used in calculation is + "Delta Degrees of Freedom": the divisor used in calculation is N - ddof. Returns ------- - variance : {ndarray, scalar}, see dtype parameter above - If out=None, returns a new array containing the variance, otherwise + variance : ndarray, see dtype parameter above + If out=None, returns a new array containing the variance; otherwise a reference to the output array is returned. See Also @@ -2079,7 +2078,7 @@ Notes ----- The variance is the average of the squared deviations from the mean, - i.e. var = mean(abs(x - x.mean())**2). The computed variance is biased, + i.e., var = mean(abs(x - x.mean())**2). The computed variance is biased, i.e., the mean is computed by dividing by the number of elements, N, rather than by N-1. Note that for complex numbers the absolute value is taken before squaring, so that the result is always real and nonnegative. Modified: branches/1.2.x/numpy/core/numeric.py =================================================================== --- branches/1.2.x/numpy/core/numeric.py 2008-10-28 00:24:27 UTC (rev 5964) +++ branches/1.2.x/numpy/core/numeric.py 2008-10-28 00:38:35 UTC (rev 5965) @@ -687,20 +687,18 @@ except ImportError: def alterdot(): """ - Change `dot`, `vdot`, and `innerproduct` to use accelerated BLAS - functions. + Change `dot`, `vdot`, and `innerproduct` to use accelerated BLAS functions. - When numpy is built with an accelerated BLAS like ATLAS, the above - functions will be replaced to make use of the faster implementations. - The faster implementations only affect float32, float64, complex64, and - complex128 arrays. Furthermore, only matrix-matrix, matrix-vector, and - vector-vector products are accelerated. Products of arrays with larger - dimensionalities will not be accelerated since the BLAS API only - includes these. + Typically, as a user of Numpy, you do not explicitly call this function. If + Numpy is built with an accelerated BLAS, this function is automatically + called when Numpy is imported. - Typically, the user will never have to call this function. If numpy was - built with an accelerated BLAS, this function will be called when numpy - is imported. + When Numpy is built with an accelerated BLAS like ATLAS, these functions + are replaced to make use of the faster implementations. The faster + implementations only affect float32, float64, complex64, and complex128 + arrays. Furthermore, the BLAS API only includes matrix-matrix, + matrix-vector, and vector-vector products. Products of arrays with larger + dimensionalities use the built in functions and are not accelerated. See Also -------- Modified: branches/1.2.x/numpy/lib/function_base.py =================================================================== --- branches/1.2.x/numpy/lib/function_base.py 2008-10-28 00:24:27 UTC (rev 5964) +++ branches/1.2.x/numpy/lib/function_base.py 2008-10-28 00:38:35 UTC (rev 5965) @@ -1128,6 +1128,17 @@ >>> np.interp(3.14, xp, fp, right=UNDEF) -99.0 + Plot an interpolant to the sine function: + + >>> x = np.linspace(0, 2*np.pi, 10) + >>> y = np.sin(x) + >>> xvals = np.linspace(0, 2*np.pi, 50) + >>> yinterp = np.interp(xvals, x, y) + >>> import matplotlib.pyplot as plt + >>> plt.plot(x, y, 'o') + >>> plt.plot(xvals, yinterp, '-x') + >>> plt.show() + """ if isinstance(x, (float, int, number)): return compiled_interp([x], xp, fp, left, right).item() Modified: branches/1.2.x/numpy/lib/polynomial.py =================================================================== --- branches/1.2.x/numpy/lib/polynomial.py 2008-10-28 00:24:27 UTC (rev 5964) +++ branches/1.2.x/numpy/lib/polynomial.py 2008-10-28 00:38:35 UTC (rev 5965) @@ -277,7 +277,7 @@ def polyder(p, m=1): """ - Return the derivative of order m of a polynomial. + Return the derivative of the specified order of a polynomial. Parameters ---------- @@ -295,6 +295,7 @@ See Also -------- polyint : Anti-derivative of a polynomial. + poly1d : Class for one-dimensional polynomials. Examples -------- Modified: branches/1.2.x/numpy/lib/twodim_base.py =================================================================== --- branches/1.2.x/numpy/lib/twodim_base.py 2008-10-28 00:24:27 UTC (rev 5964) +++ branches/1.2.x/numpy/lib/twodim_base.py 2008-10-28 00:38:35 UTC (rev 5965) @@ -165,14 +165,14 @@ Number of columns in the output. If None, defaults to `N`. k : int, optional Index of the diagonal: 0 refers to the main diagonal, a positive value - refers to an upper diagonal and a negative value to a lower diagonal. + refers to an upper diagonal, and a negative value to a lower diagonal. dtype : dtype, optional Data-type of the returned array. Returns ------- I : ndarray (N,M) - An array where all elements are equal to zero, except for the k'th + An array where all elements are equal to zero, except for the `k`-th diagonal, whose values are equal to one. See Also Modified: branches/1.2.x/numpy/random/mtrand/mtrand.pyx =================================================================== --- branches/1.2.x/numpy/random/mtrand/mtrand.pyx 2008-10-28 00:24:27 UTC (rev 5964) +++ branches/1.2.x/numpy/random/mtrand/mtrand.pyx 2008-10-28 00:38:35 UTC (rev 5965) @@ -1902,7 +1902,7 @@ """ lognormal(mean=0.0, sigma=1.0, size=None) - Log-normal distribution. + 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 @@ -1938,7 +1938,7 @@ 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 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 @@ -1947,7 +1947,7 @@ 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 lognormal distribution has widespread + most mechanical systems, the log-normal distribution has widespread application. It is also commonly used to model oil field sizes, species abundance, and @@ -1986,7 +1986,7 @@ >>> plt.show() Demonstrate that taking the products of random samples from a uniform - distribution can be fit well by a log-normal pdf. + 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. From numpy-svn at scipy.org Mon Oct 27 20:54:16 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 27 Oct 2008 19:54:16 -0500 (CDT) Subject: [Numpy-svn] r5966 - in branches/1.2.x/numpy: . core core/code_generators doc fft lib linalg ma random/mtrand Message-ID: <20081028005416.EFAFF39C089@scipy.org> Author: ptvirtan Date: 2008-10-27 19:53:04 -0500 (Mon, 27 Oct 2008) New Revision: 5966 Modified: branches/1.2.x/numpy/__init__.py branches/1.2.x/numpy/add_newdocs.py branches/1.2.x/numpy/core/arrayprint.py branches/1.2.x/numpy/core/code_generators/docstrings.py branches/1.2.x/numpy/core/defchararray.py branches/1.2.x/numpy/core/fromnumeric.py branches/1.2.x/numpy/core/numeric.py branches/1.2.x/numpy/core/numerictypes.py branches/1.2.x/numpy/doc/basics.py branches/1.2.x/numpy/doc/creation.py branches/1.2.x/numpy/doc/glossary.py branches/1.2.x/numpy/doc/misc.py branches/1.2.x/numpy/doc/subclassing.py branches/1.2.x/numpy/fft/fftpack.py branches/1.2.x/numpy/fft/helper.py branches/1.2.x/numpy/lib/__init__.py branches/1.2.x/numpy/lib/_datasource.py branches/1.2.x/numpy/lib/arraysetops.py branches/1.2.x/numpy/lib/financial.py branches/1.2.x/numpy/lib/function_base.py branches/1.2.x/numpy/lib/getlimits.py branches/1.2.x/numpy/lib/index_tricks.py branches/1.2.x/numpy/lib/io.py branches/1.2.x/numpy/lib/polynomial.py branches/1.2.x/numpy/lib/shape_base.py branches/1.2.x/numpy/lib/twodim_base.py branches/1.2.x/numpy/lib/type_check.py branches/1.2.x/numpy/lib/ufunclike.py branches/1.2.x/numpy/lib/utils.py branches/1.2.x/numpy/linalg/linalg.py branches/1.2.x/numpy/ma/__init__.py branches/1.2.x/numpy/ma/core.py branches/1.2.x/numpy/ma/extras.py branches/1.2.x/numpy/matlib.py branches/1.2.x/numpy/random/mtrand/mtrand.pyx Log: 1.2.x: Backport r5963 from trunk: Import documentation from doc wiki (part 2, work-in-progress docstrings, but they are still an improvement) Modified: branches/1.2.x/numpy/__init__.py =================================================================== --- branches/1.2.x/numpy/__init__.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/__init__.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -30,13 +30,18 @@ >>> help(np.sort) -For some objects, ``np.info(obj)`` may provide additional help. +For some objects, ``np.info(obj)`` may provide additional help. This is +particularly true if you see the line "Help on ufunc object:" at the top +of the help() page. Ufuncs are implemented in C, not Python, for speed. +The native Python help() does not know how to view their help, but our +np.info() function does. -To search for objects of which the documentation contains keywords, do:: +To search for documents containing a keyword, do:: >>> np.lookfor('keyword') -Topical documentation is available under the ``doc`` sub-module:: +General-purpose documents like a glossary and help on the basic concepts +of numpy are available under the ``doc`` sub-module:: >>> from numpy import doc >>> help(doc) @@ -87,10 +92,10 @@ Copies vs. in-place operation ----------------------------- -Most of the methods in `numpy` return a copy of the array argument (e.g., -`sort`). In-place versions of these methods are often available as -array methods, i.e. ``x = np.array([1,2,3]); x.sort()``. Exceptions to -this rule are documented. +Most of the functions in `numpy` return a copy of the array argument +(e.g., `sort`). In-place versions of these functions are often +available as array methods, i.e. ``x = np.array([1,2,3]); x.sort()``. +Exceptions to this rule are documented. """ Modified: branches/1.2.x/numpy/add_newdocs.py =================================================================== --- branches/1.2.x/numpy/add_newdocs.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/add_newdocs.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -65,12 +65,26 @@ add_newdoc('numpy.core', 'dtype', """ - Create a data type. + dtype(obj, align=False, copy=False) + Create a data type object. + A numpy array is homogeneous, and contains elements described by a - dtype. A dtype can be constructed from different combinations of - fundamental numeric types, as illustrated below. + dtype object. A dtype object can be constructed from different + combinations of fundamental numeric types. + Parameters + ---------- + obj + Object to be converted to a data type object. + align : bool, optional + Add padding to the fields to match what a C compiler would output + for a similar C-struct. Can be ``True`` only if `obj` is a dictionary + or a comma-separated string. + copy : bool, optional + Make a new copy of the data-type object. If ``False``, the result + may just be a reference to a built-in data-type object. + Examples -------- Using array-scalar type: @@ -228,7 +242,7 @@ Parameters ---------- - object : array-like + object : array_like An array, any object exposing the array interface, an object whose __array__ method returns an array, or any (nested) sequence. @@ -752,15 +766,16 @@ Values are generated within the half-open interval ``[start, stop)`` (in other words, the interval including `start` but excluding `stop`). - For integer arguments, the function is equivalent to ``range`` - (but returns an array). + For integer arguments the function is equivalent to the Python built-in + `range `_ function, + but returns a ndarray rather than a list. Parameters ---------- start : number, optional Start of interval. The interval includes this value. The default start value is 0. - end : number + stop : number End of interval. The interval does not include this value. step : number, optional Spacing between values. For any output `out`, this is the distance @@ -782,7 +797,6 @@ See Also -------- - range : The Python equivalent for integers linspace : Evenly spaced numbers with careful handling of endpoints. ogrid: Arrays of evenly spaced numbers in N-dimensions mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions @@ -913,7 +927,7 @@ See Also -------- - nonzero + nonzero, choose Notes ----- @@ -964,18 +978,19 @@ keys : (k,N) array or tuple containing k (N,)-shaped sequences The `k` different "columns" to be sorted. The last column is the primary sort column. - axis : integer, optional + axis : int, optional Axis to be indirectly sorted. By default, sort over the last axis. Returns ------- - indices : (N,) integer array + indices : (N,) ndarray of ints Array of indices that sort the keys along the specified axis. See Also -------- argsort : Indirect sort. - sort : In-place sort. + ndarray.sort : In-place sort. + sort : Return a sorted copy of an array. Examples -------- @@ -1255,7 +1270,7 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('imag', """ - Imaginary part of the array. + The imaginary part of the array. Examples -------- @@ -1285,8 +1300,53 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('flags', - """Special object providing array flags. + """ + Information about the memory layout of the array. + Attributes + ---------- + C_CONTIGUOUS (C) + The data is in a single, C-style contiguous segment. + F_CONTIGUOUS (F) + The data is in a single, Fortran-style contiguous segment. + OWNDATA (O) + The array owns the memory it uses or borrows it from another object. + WRITEABLE (W) + The data area can be written to. + ALIGNED (A) + The data and strides are aligned appropriately for the hardware. + UPDATEIFCOPY (U) + This array is a copy of some other array. When this array is + deallocated, the base array will be updated with the contents of + this array. + + FNC + F_CONTIGUOUS and not C_CONTIGUOUS. + FORC + F_CONTIGUOUS or C_CONTIGUOUS (one-segment test). + BEHAVED (B) + ALIGNED and WRITEABLE. + CARRAY (CA) + BEHAVED and C_CONTIGUOUS. + FARRAY (FA) + BEHAVED and F_CONTIGUOUS and not C_CONTIGUOUS. + + Notes + ----- + The `flags` object can be also accessed dictionary-like, and using + lowercased attribute names. Short flag names are only supported in + dictionary access. + + Only the UPDATEIFCOPY, WRITEABLE, and ALIGNED flags can be changed by + the user, via assigning to ``flags['FLAGNAME']`` or `ndarray.setflags`. + The array flags cannot be set arbitrarily: + + - UPDATEIFCOPY can only be set ``False``. + - ALIGNED can only be set ``True`` if the data is truly aligned. + - WRITEABLE can only be set ``True`` if the array owns its own memory + or the ultimate owner of the memory exposes a writeable buffer + interface or is a string. + """)) @@ -1340,7 +1400,7 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('real', """ - Real part of the array. + The real part of the array. Examples -------- @@ -1500,7 +1560,7 @@ """ a.all(axis=None, out=None) - Check if all of the elements of `a` are true. + Returns True if all elements evaluate to True. Refer to `numpy.all` for full documentation. @@ -1542,7 +1602,7 @@ Returns ------- - index_array : {ndarray, int} + index_array : ndarray An array of indices or single index value, or a reference to `out` if it was specified. @@ -1609,11 +1669,42 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('byteswap', - """a.byteswap(False) -> View or copy. Swap the bytes in the array. + """ + a.byteswap(inplace) - Swap the bytes in the array. Return the byteswapped array. If the first - argument is True, byteswap in-place and return a reference to self. + Swap the bytes of the array elements + Toggle between low-endian and big-endian data representation by + returning a byteswapped array, optionally swapped in-place. + + Parameters + ---------- + inplace: bool, optional + If ``True``, swap bytes in-place, default is ``False``. + + Returns + ------- + out: ndarray + The byteswapped array. If `inplace` is ``True``, this is + a view to self. + + Examples + -------- + >>> A = np.array([1, 256, 8755], dtype=np.int16) + >>> map(hex, A) + ['0x1', '0x100', '0x2233'] + >>> A.byteswap(True) + array([ 256, 1, 13090], dtype=int16) + >>> map(hex, A) + ['0x100', '0x1', '0x3322'] + + Arrays of strings are not swapped + + >>> A = np.array(['ceg', 'fac']) + >>> A.byteswap() + array(['ceg', 'fac'], + dtype='|S3') + """)) @@ -1680,7 +1771,7 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('copy', """ - a.copy([order]) + a.copy(order='C') Return a copy of the array. @@ -1795,10 +1886,6 @@ value : scalar All elements of `a` will be assigned this value. - Returns - ------- - None - Examples -------- >>> a = np.array([1, 2]) @@ -1917,7 +2004,7 @@ """ a.nonzero() - Return the indices of the elements of a which are not zero. + Return the indices of the elements that are non-zero. Refer to `numpy.nonzero` for full documentation. @@ -1977,10 +2064,12 @@ """ putmask(a, mask, values) - Sets a.flat[n] = values[n] for each n where mask.flat[n] is true. + Changes elements of an array based on conditional and input values. + Sets `a`.flat[n] = `values`\\[n] for each n where `mask`.flat[n] is true. + If `values` is not the same size as `a` and `mask` then it will repeat. - This gives behavior different from a[mask] = values. + This gives behavior different from `a[mask] = values`. Parameters ---------- @@ -1993,7 +2082,7 @@ See Also -------- - put, take + place, put, take Examples -------- @@ -2050,7 +2139,7 @@ """ a.reshape(shape, order='C') - Returns an array containing the data of a, but with a new shape. + Returns an array containing the same data with a new shape. Refer to `numpy.reshape` for full documentation. @@ -2167,42 +2256,48 @@ Parameters ---------- - axis : integer - Axis to be sorted along. None indicates that the flattened array - should be used. Default is -1. - kind : string - Sorting algorithm to use. Possible values are 'quicksort', - 'mergesort', or 'heapsort'. Default is 'quicksort'. - order : list type or None - When a is an array with fields defined, this argument specifies + axis : int, optional + Axis along which to sort. Default is -1, which means sort along the + last axis. + kind : {'quicksort', 'mergesort', 'heapsort'}, optional + Sorting algorithm. Default is 'quicksort'. + order : list, optional + When `a` is an array with fields defined, this argument specifies which fields to compare first, second, etc. Not all fields need be specified. See Also -------- - argsort : indirect sort - lexsort : indirect stable sort on multiple keys - searchsorted : find keys in sorted array + numpy.sort : Return a sorted copy of an array. + argsort : Indirect sort. + lexsort : Indirect stable sort on multiple keys. + searchsorted : Find elements in sorted array. Notes ----- - The various sorts are characterized by average speed, worst case - performance, need for work space, and whether they are stable. A stable - sort keeps items with the same key in the same relative order. The three - available algorithms have the following properties: + See ``sort`` for notes on the different sorting algorithms. - =========== ======= ============= ============ ======= - kind speed worst case work space stable - =========== ======= ============= ============ ======= - 'quicksort' 1 O(n^2) 0 no - 'mergesort' 2 O(n*log(n)) ~n/2 yes - 'heapsort' 3 O(n*log(n)) 0 no - =========== ======= ============= ============ ======= + Examples + -------- + >>> a = np.array([[1,4], [3,1]]) + >>> a.sort(axis=1) + >>> a + array([[1, 4], + [1, 3]]) + >>> a.sort(axis=0) + >>> a + array([[1, 3], + [1, 4]]) - All the sort algorithms make temporary copies of the data when the sort is - not along the last axis. Consequently, sorts along the last axis are faster - and use less space than sorts along other axis. + Use the `order` keyword to specify a field to use when sorting a + structured array: + >>> a = np.array([('a', 2), ('c', 1)], dtype=[('x', 'S1'), ('y', int)]) + >>> a.sort(order='y') + >>> a + array([('c', 1), ('a', 2)], + dtype=[('x', '|S1'), ('y', '>> a = np.array([1, 2]) >>> a.tolist() [1, 2] >>> a = np.array([[1, 2], [3, 4]]) + >>> list(a) + [array([1, 2]), array([3, 4])] >>> a.tolist() [[1, 2], [3, 4]] @@ -2465,8 +2567,9 @@ """) -add_newdoc('numpy.core.umath','seterrobj', - """seterrobj() +add_newdoc('numpy.core.umath', 'seterrobj', + """ + seterrobj(errobj) Used internally by `seterr`. @@ -2481,8 +2584,9 @@ """) -add_newdoc("numpy.core","ufunc", - """Functions that operate element by element on whole arrays. +add_newdoc('numpy.core', 'ufunc', + """ + Functions that operate element by element on whole arrays. Unary ufuncs: ============= @@ -2492,13 +2596,14 @@ Parameters ---------- - X : array-like - out : array-like + X : array_like + Input array + out : array_like An array to store the output. Must be the same shape as X. Returns ------- - r : array-like + r : array_like r will have the same shape as X; if out is provided, r will be equal to out. @@ -2515,8 +2620,10 @@ Parameters ---------- - X : array-like - Y : array-like + X : array_like + First input array + Y : array_like + Second input array out : array-like An array to store the output. Must be the same shape as the output would have. @@ -2547,21 +2654,21 @@ Parameters ---------- - array : array-like + array : array_like The array to act on. - axis : integer + axis : integer, optional The axis along which to apply the reduction. - dtype : {data-type-code, None} + dtype : data-type-code, optional The type used to represent the intermediate results. Defaults to the data type of the output array if this is provided, or the data type of the input array if no output array is provided. - out : {array-like, None} + out : array_like, optional A location into which the result is stored. If not provided a freshly-allocated array is returned. Returns ------- - r : {array, scalar} + r : ndarray The reduced values. If out was supplied, r is equal to out. Examples @@ -2690,14 +2797,14 @@ Parameters ---------- - A : array-like + A : array_like First term - B : array-like + B : array_like Second term Returns ------- - r : array + r : ndarray Output array Examples Modified: branches/1.2.x/numpy/core/arrayprint.py =================================================================== --- branches/1.2.x/numpy/core/arrayprint.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/core/arrayprint.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -42,23 +42,23 @@ Parameters ---------- - precision : int + precision : int, optional Number of digits of precision for floating point output (default 8). - threshold : int + threshold : int, optional Total number of array elements which trigger summarization rather than full repr (default 1000). - edgeitems : int + edgeitems : int, optional Number of array items in summary at beginning and end of each dimension (default 3). - linewidth : int + linewidth : int, optional The number of characters per line for the purpose of inserting line breaks (default 75). - suppress : bool + suppress : bool, optional Whether or not suppress printing of small floating point values using scientific notation (default False). - nanstr : string + nanstr : string, optional String representation of floating point not-a-number (default nan). - infstr : string + infstr : string, optional String representation of floating point infinity (default inf). Examples @@ -242,7 +242,8 @@ The maximum number of columns the string should span. Newline characters splits the string appropriately after array elements. precision : int, optional - Floating point precision. + Floating point precision. Default is the current printing + precision (usually 8), which can be altered using `set_printoptions`. suppress_small : bool, optional Represent very small numbers as zero. separator : string, optional @@ -259,7 +260,7 @@ See Also -------- - array_str, array_repr + array_str, array_repr, set_printoptions Examples -------- Modified: branches/1.2.x/numpy/core/code_generators/docstrings.py =================================================================== --- branches/1.2.x/numpy/core/code_generators/docstrings.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/core/code_generators/docstrings.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -95,7 +95,7 @@ Returns ------- - angle : {ndarray, scalar} + angle : ndarray The angle of the ray intersecting the unit circle at the given `x`-coordinate in radians [0, pi]. If `x` is a scalar then a scalar is returned, otherwise an array of the same shape as `x` @@ -156,7 +156,7 @@ Returns ------- - out : {ndarray, scalar} + out : ndarray Array of the same shape and dtype as `x`. Notes @@ -198,7 +198,7 @@ Returns ------- - angle : {ndarray, scalar} + angle : ndarray The angle of the ray intersecting the unit circle at the given `y`-coordinate in radians ``[-pi, pi]``. If `x` is a scalar then a scalar is returned, otherwise an array is returned. @@ -263,7 +263,7 @@ For real-valued input data types, `arcsinh` always returns real output. For each value that cannot be expressed as a real number or infinity, it - yields ``nan`` and sets the `invalid` floating point error flag. + returns ``nan`` and sets the `invalid` floating point error flag. For complex-valued input, `arccos` is a complex analytical function that has branch cuts `[1j, infj]` and `[-1j, -infj]` and is continuous from @@ -294,12 +294,12 @@ Parameters ---------- - x : {array_like, scalar} + x : array_like Input values. `arctan` is applied to each element of `x`. Returns ------- - out : {ndarray, scalar} + out : ndarray Out has the same shape as `x`. Its real part is in ``[-pi/2, pi/2]``. It is a scalar if `x` is a scalar. @@ -363,15 +363,15 @@ Parameters ---------- - x1 : array-like, real-valued + x1 : array_like, real-valued y-coordinates. - x2 : array-like, real-valued + x2 : array_like, real-valued x-coordinates. `x2` must be broadcastable to match the shape of `x1`, or vice versa. Returns ------- - angle : array-like + angle : ndarray Array of angles in radians, in the range ``[-pi, pi]``. See Also @@ -726,7 +726,7 @@ Returns ------- - y : {ndarray, scalar} + y : ndarray The complex conjugate of `x`, with same dtype as `y`. Examples @@ -793,12 +793,12 @@ Parameters ---------- - x : array-like + x : array_like Angle in radians. Returns ------- - y : {ndarray, scalar} + y : ndarray The corresponding angle in degrees. @@ -964,8 +964,38 @@ add_newdoc('numpy.core.umath', 'expm1', """ - e**x-1 elementwise. + Return the exponential of the elements in the array minus one. + Parameters + ---------- + x : array_like + Input values. + + Returns + ------- + out : ndarray + Element-wise exponential minus one: ``out=exp(x)-1``. + + See Also + -------- + log1p : ``log(1+x)``, the inverse of expm1. + + + Notes + ----- + This function provides greater precision than using ``exp(x)-1`` + for small values of `x`. + + Examples + -------- + Since the series expansion of ``e**x = 1 + x + x**2/2! + x**3/3! + ...``, + for very small `x` we expect that ``e**x -1 ~ x + x**2/2``: + + >>> np.expm1(1e-10) + 1.00000000005e-10 + >>> np.exp(1e-10) - 1 + 1.000000082740371e-10 + """) add_newdoc('numpy.core.umath', 'fabs', @@ -1135,7 +1165,7 @@ add_newdoc('numpy.core.umath', 'greater_equal', """ - Returns (x1 >= x2) element-wise. + Element-wise True if first array is greater or equal than second array. Parameters ---------- @@ -1144,12 +1174,12 @@ Returns ------- - Out : {ndarray, bool} - Output array of bools, or a single bool if `x1` and `x2` are scalars. + out : ndarray, bool + Output array. See Also -------- - greater + greater, less, less_equal, equal Examples -------- @@ -1164,17 +1194,16 @@ Parameters ---------- - x : array-like + x : array_like Base of the triangle. - y : array-like + y : array_like Height of the triangle. Returns ------- - z : {ndarray, scalar} + z : ndarray Hypotenuse of the triangle: sqrt(x**2 + y**2) - Examples -------- >>> np.hypot(3,4) @@ -1277,66 +1306,182 @@ add_newdoc('numpy.core.umath', 'isfinite', """ - Returns True where x is finite, False otherwise. + Returns True for each element that is a finite number. + Shows which elements of the input are finite (not infinity or not + Not a Number). + Parameters ---------- x : array_like - input values + Input values. + y : array_like, optional + A boolean array with the same shape and type as `x` to store the result. Returns ------- - y : {ndarray, bool} - array of bools + y : ndarray, bool + For scalar input data, the result is a new numpy boolean with value True + if the input data is finite; otherwise the value is False (input is + either positive infinity, negative infinity or Not a Number). + For array input data, the result is an numpy boolean array with the same + dimensions as the input and the values are True if the corresponding + element of the input is finite; otherwise the values are False (element + is either positive infinity, negative infinity or Not a Number). If the + second argument is supplied then an numpy integer array is returned with + values 0 or 1 corresponding to False and True, respectively. + + See Also + -------- + isinf : Shows which elements are negative or negative infinity. + isneginf : Shows which elements are negative infinity. + isposinf : Shows which elements are positive infinity. + isnan : Shows which elements are Not a Number (NaN). + + Notes ----- - `Nan` is considered as non-finite. + Not a Number, positive infinity and negative infinity are considered + to be non-finite. + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Also that positive infinity is not equivalent to negative infinity. But + infinity is equivalent to positive infinity. + + Errors result if second argument is also supplied with scalar input or + if first and second arguments have different shapes. + Examples -------- + >>> np.isfinite(1) + True + >>> np.isfinite(0) + True + >>> np.isfinite(np.nan) + False + >>> np.isfinite(np.inf) + False + >>> np.isfinite(np.NINF) + False >>> np.isfinite([np.log(-1.),1.,np.log(0)]) array([False, True, False], dtype=bool) + >>> x=np.array([-np.inf, 0., np.inf]) + >>> y=np.array([2,2,2]) + >>> np.isfinite(x,y) + array([0, 1, 0]) + >>> y + array([0, 1, 0]) """) add_newdoc('numpy.core.umath', 'isinf', """ - Returns True where x is +inf or -inf, False otherwise. + Shows which elements of the input are positive or negative infinity. + Returns a numpy boolean scalar or array resulting from an element-wise test + for positive or negative infinity. Parameters ---------- x : array_like input values + y : array_like, optional + An array with the same shape as `x` to store the result. Returns ------- y : {ndarray, bool} - array of bools + For scalar input data, the result is a new numpy boolean with value True + if the input data is positive or negative infinity; otherwise the value + is False. + For array input data, the result is an numpy boolean array with the same + dimensions as the input and the values are True if the corresponding + element of the input is positive or negative infinity; otherwise the + values are False. If the second argument is supplied then an numpy + integer array is returned with values 0 or 1 corresponding to False and + True, respectively. + + See Also + -------- + isneginf : Shows which elements are negative infinity. + isposinf : Shows which elements are positive infinity. + isnan : Shows which elements are Not a Number (NaN). + isfinite: Shows which elements are not: Not a number, positive and + negative infinity + + Notes + ----- + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Also that positive infinity is not equivalent to negative infinity. But + infinity is equivalent to positive infinity. + + Errors result if second argument is also supplied with scalar input or + if first and second arguments have different shapes. + + Numpy's definitions for positive infinity (PINF) and negative infinity + (NINF) may be change in the future versions. + Examples -------- + >>> np.isinf(np.inf) + True + >>> np.isinf(np.nan) + False + >>> np.isinf(np.NINF) + True >>> np.isinf([np.inf, -np.inf, 1.0, np.nan]) array([ True, True, False, False], dtype=bool) + >>> x=np.array([-np.inf, 0., np.inf]) + >>> y=np.array([2,2,2]) + >>> np.isinf(x,y) + array([1, 0, 1]) + >>> y + array([1, 0, 1]) """) add_newdoc('numpy.core.umath', 'isnan', """ - Returns True where elements are Not-A-Number, False otherwise. + Returns a numpy boolean scalar or array resulting from an element-wise test + for Not a Number (NaN). Parameters ---------- x : array_like - input values. + input data. Returns ------- y : {ndarray, bool} - array of bools + For scalar input data, the result is a new numpy boolean with value True + if the input data is NaN; otherwise the value is False. + For array input data, the result is an numpy boolean array with the same + dimensions as the input and the values are True if the corresponding + element of the input is Not a Number; otherwise the values are False. + + See Also + -------- + isinf : Tests for infinity. + isneginf : Tests for negative infinity. + isposinf : Tests for positive infinity. + isfinite : Shows which elements are not: Not a number, positive infinity + and negative infinity + + Notes + ----- + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Examples -------- + >>> np.isnan(np.nan) + True + >>> np.isnan(np.inf) + False >>> np.isnan([np.log(-1.),1.,np.log(0)]) array([ True, False, False], dtype=bool) @@ -1344,8 +1489,35 @@ add_newdoc('numpy.core.umath', 'left_shift', """ - Computes x1 << x2 (x1 shifted to left by x2 bits) elementwise. + Shift the bits of an integer to the left. + Bits are shifted to the left by appending `x2` 0s at the right of `x1`. + Since the internal representation of numbers is in binary format, this + operation is equivalent to multiplying `x1` by ``2**x2``. + + Parameters + ---------- + x1 : array_like of integer type + Input values. + x2 : array_like of integer type + Number of zeros to append to `x1`. + + Returns + ------- + out : array of integer type + Return `x1` with bits shifted `x2` times to the left. + + See Also + -------- + right_shift : Shift the bits of an integer to the right. + binary_repr : Return the binary representation of the input number + as a string. + + Examples + -------- + >>> np.left_shift(5, [1,2,3]) + array([10, 20, 40]) + """) add_newdoc('numpy.core.umath', 'less', @@ -1354,7 +1526,7 @@ Parameters ---------- - x1, x2 : array-like + x1, x2 : array_like Input arrays. Returns @@ -1408,12 +1580,12 @@ Parameters ---------- x : array_like - Input value. + Input value. Returns ------- - y : {ndarray, scalar} - The natural logarithm of `x`, element-wise. + y : ndarray + The natural logarithm of `x`, element-wise. See Also -------- @@ -1449,19 +1621,18 @@ add_newdoc('numpy.core.umath', 'log10', """ - Compute the logarithm in base 10 elementwise. + Compute the logarithm in base 10 element-wise. Parameters ---------- x : array_like - input values. + Input values. Returns ------- - y : {ndarray, scalar} - base-10 logarithm of `x`. + y : ndarray + Base-10 logarithm of `x`. - Notes ----- Logarithm is a multivalued function: for each `x` there is an infinite @@ -1501,7 +1672,7 @@ Returns ------- - y : {ndarray, scalar} + y : ndarray Natural logarithm of `1 + x`, elementwise. Notes @@ -1674,14 +1845,80 @@ add_newdoc('numpy.core.umath', 'maximum', """ - Returns maximum (if x1 > x2: x1; else: x2) elementwise. + Element-wise maximum of array elements. + Compare two arrays and returns a new array containing + the element-wise maxima. + + Parameters + ---------- + x1, x2 : array_like + The arrays holding the elements to be compared. + + Returns + ------- + y : {ndarray, scalar} + The maximum of `x1` and `x2`, element-wise. Returns scalar if + both `x1` and `x2` are scalars. + + See Also + -------- + minimum : + element-wise minimum + + Notes + ----- + Equivalent to ``np.where(x1 > x2, x1, x2)`` but faster and does proper + broadcasting. + + Examples + -------- + >>> np.maximum([2, 3, 4], [1, 5, 2]) + array([2, 5, 4]) + + >>> np.maximum(np.eye(2), [0.5, 2]) + array([[ 1. , 2. ], + [ 0.5, 2. ]]) + """) add_newdoc('numpy.core.umath', 'minimum', """ - Returns minimum (if x1 < x2: x1; else: x2) elementwise + Element-wise minimum of array elements. + Compare two arrays and returns a new array containing + the element-wise minima. + + Parameters + ---------- + x1, x2 : array_like + The arrays holding the elements to be compared. + + Returns + ------- + y : {ndarray, scalar} + The minimum of `x1` and `x2`, element-wise. Returns scalar if + both `x1` and `x2` are scalars. + + See Also + -------- + maximum : + element-wise maximum + + Notes + ----- + Equivalent to ``np.where(x1 < x2, x1, x2)`` but faster and does proper + broadcasting. + + Examples + -------- + >>> np.minimum([2, 3, 4], [1, 5, 2]) + array([1, 3, 2]) + + >>> np.minimum(np.eye(2), [0.5, 2]) + array([[ 0.5, 0. ], + [ 0. , 1. ]]) + """) add_newdoc('numpy.core.umath', 'modf', @@ -1718,12 +1955,12 @@ Parameters ---------- - x1, x2 : array-like + x1, x2 : array_like The arrays to be multiplied. Returns ------- - y : {ndarray, scalar} + y : ndarray The product of `x1` and `x2`, elementwise. Returns a scalar if both `x1` and `x2` are scalars. @@ -1797,7 +2034,7 @@ add_newdoc('numpy.core.umath', 'ones_like', """ - Returns an array of zeros with the same shape and type as a given array. + Returns an array of ones with the same shape and type as a given array. Equivalent to ``a.copy().fill(1)``. @@ -1818,7 +2055,7 @@ add_newdoc('numpy.core.umath', 'power', """ - Computes `x1` ** `x2` elementwise. + Returns element-wise base array raised to power from second array. Raise each base in `x1` to the power of the exponents in `x2`. This requires that `x1` and `x2` must be broadcastable to the same shape. @@ -1874,7 +2111,7 @@ Returns ------- - y : {ndarray, scalar} + y : ndarray The corresponding angle in radians. See Also @@ -1895,7 +2132,7 @@ add_newdoc('numpy.core.umath', 'reciprocal', """ - Compute 1/x. + Return element-wise reciprocal. Parameters ---------- @@ -1904,7 +2141,7 @@ Returns ------- - y : {ndarray, scalar} + y : ndarray Return value. Examples @@ -1918,8 +2155,10 @@ add_newdoc('numpy.core.umath', 'remainder', """ - Computes x1-n*x2 where n is floor(x1 / x2) + Returns element-wise remainder of division. + Computes `x1 - floor(x1/x2)*x2`. + Parameters ---------- x1 : array_like @@ -1929,9 +2168,9 @@ Returns ------- - y : {ndarray, scalar} - The quotient `x1/x2`, element-wise. Returns a scalar if - both `x1` and `x2` are scalars. + y : ndarray + The remainder of the quotient `x1/x2`, element-wise. Returns a scalar + if both `x1` and `x2` are scalars. See Also -------- @@ -1951,8 +2190,35 @@ add_newdoc('numpy.core.umath', 'right_shift', """ - Computes x1 >> x2 (x1 shifted to right by x2 bits) elementwise. + Shift the bits of an integer to the right. + Bits are shifted to the right by removing `x2` bits at the right of `x1`. + Since the internal representation of numbers is in binary format, this + operation is equivalent to dividing `x1` by ``2**x2``. + + Parameters + ---------- + x1 : array_like, int + Input values. + x2 : array_like, int + Number of bits to remove at the right of `x1`. + + Returns + ------- + out : ndarray, int + Return `x1` with bits shifted `x2` times to the right. + + See Also + -------- + left_shift : Shift the bits of an integer to the left. + binary_repr : Return the binary representation of the input number + as a string. + + Examples + -------- + >>> np.right_shift(10, [1,2,3]) + array([5, 2, 1]) + """) add_newdoc('numpy.core.umath', 'rint', @@ -1979,9 +2245,9 @@ add_newdoc('numpy.core.umath', 'sign', """ - Return the sign of a number. + Returns an element-wise indication of the sign of a number. - -1 if x < 0, 0 if x==0, 1 if x > 0. + The `sign` function returns ``-1 if x < 0, 0 if x==0, 1 if x > 0``. Parameters ---------- @@ -1990,7 +2256,7 @@ Returns ------- - y : {ndarray, scalar} + y : ndarray The sign of `x`. Examples @@ -2004,20 +2270,23 @@ add_newdoc('numpy.core.umath', 'signbit', """ - Returns True where `signbit` of `x` is set (`x<0`). + Returns element-wise True where signbit is set (less than zero). Parameters ---------- - x: array-like or scalar - the input value(s). - output : array-like or scalar - the returned boolean(s) + x: array_like + The input value(s). + Returns + ------- + out : array_like, bool + Output. + Examples -------- >>> np.signbit(-1.2) True - >>> np.signbit(np.array([1,-2.3,2.1])) + >>> np.signbit(np.array([1, -2.3, 2.1])) array([False, True, False], dtype=bool) """) @@ -2138,18 +2407,18 @@ add_newdoc('numpy.core.umath', 'square', """ - Compute `x` squared, or `x` to the power of two. + Return the element-wise square of the input. Parameters ---------- - x : array_like or scalar + x : array_like Input data. Returns ------- - out : ndarray or scalar + out : ndarray Element-wise `x*x`, of the same shape and dtype as `x`. - `out` is a scalar if `x` is a scalar. + Returns scalar if `x` is a scalar. See Also -------- @@ -2166,18 +2435,18 @@ add_newdoc('numpy.core.umath', 'subtract', """ - Subtract arguments elementwise. + Subtract arguments element-wise. Parameters ---------- - x1, x2 : {array_like, scalar} + x1, x2 : array_like The arrays to be subtracted from each other. If type is 'array_like' the `x1` and `x2` shapes must be identical. Returns ------- - y : {ndarray, scalar} - The difference of `x1` and `x2`, elementwise. Returns a scalar if + y : ndarray + The difference of `x1` and `x2`, element-wise. Returns a scalar if both `x1` and `x2` are scalars. Notes @@ -2200,7 +2469,7 @@ add_newdoc('numpy.core.umath', 'tan', """ - Compute tangent elementwise. + Compute tangent element-wise. Parameters ---------- @@ -2209,7 +2478,7 @@ Returns ------- - y : ndarray or scalar + y : ndarray The corresponding tangent values. @@ -2223,7 +2492,7 @@ add_newdoc('numpy.core.umath', 'tanh', """ - Hyperbolic tangent elementwise. + Hyperbolic tangent element-wise. Parameters ---------- @@ -2232,14 +2501,14 @@ Returns ------- - y : ndarray or scalar + y : ndarray The corresponding hyperbolic tangent values. """) add_newdoc('numpy.core.umath', 'true_divide', """ - Returns an elementwise, true division of the inputs. + Returns an element-wise, true division of the inputs. Instead of the Python traditional 'floor division', this returns a true division. True division adjusts the output type to present the best @@ -2254,7 +2523,7 @@ Returns ------- - out : {ndarray, scalar} + out : ndarray Result is scalar if both inputs are scalar, ndarray otherwise. Notes Modified: branches/1.2.x/numpy/core/defchararray.py =================================================================== --- branches/1.2.x/numpy/core/defchararray.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/core/defchararray.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -16,6 +16,20 @@ # comparisons class chararray(ndarray): + """ + chararray(shape, itemsize=1, unicode=False, buffer=None, offset=0, + strides=None, order=None) + + A character array of string or unicode type. + + The array items will be `itemsize` characters long. + + Create the array using buffer (with offset and strides) if it is + not None. If buffer is None, then construct a new array with strides + in Fortran order if len(shape) >=2 and order is 'Fortran' (otherwise + the strides will be in 'C' order). + + """ def __new__(subtype, shape, itemsize=1, unicode=False, buffer=None, offset=0, strides=None, order='C'): global _globalvar Modified: branches/1.2.x/numpy/core/fromnumeric.py =================================================================== --- branches/1.2.x/numpy/core/fromnumeric.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/core/fromnumeric.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -44,17 +44,17 @@ def take(a, indices, axis=None, out=None, mode='raise'): """ - Take elements from an array along a given axis. + Take elements from an array along an axis. This function does the same thing as "fancy" indexing (indexing arrays - using arrays); however, it can be easier to use if you need to specify - a given axis. + using arrays); however, it can be easier to use if you need elements + along a given axis. Parameters ---------- - a : ndarray + a : array_like The source array. - indices : int array + indices : array_like, int The indices of the values to extract. axis : int, optional The axis over which to select values. By default, the @@ -77,6 +77,18 @@ -------- ndarray.take : equivalent method + Examples + -------- + >>> a = [4, 3, 5, 7, 6, 8] + >>> indices = [0, 1, 4] + >>> np.take(a, indices) + array([4, 3, 6]) + + In this example if `a` is a ndarray, "fancy" indexing can be used. + >>> a = np.array(a) + >>> a[indices] + array([4, 3, 6]) + """ try: take = a.take @@ -88,15 +100,17 @@ # not deprecated --- copy if necessary, view otherwise def reshape(a, newshape, order='C'): """ - Returns an array containing the data of a, but with a new shape. + Gives a new shape to an array without changing its data. Parameters ---------- - a : ndarray + a : array_like Array to be reshaped. newshape : {tuple, int} - The new shape should be compatible with the original shape. If an - integer, then the result will be a 1-D array of that length. + The new shape should be compatible with the original shape. If + an integer, then the result will be a 1-D array of that length. + One shape dimension can be -1. In this case, the value is inferred + from the length of the array and remaining dimensions. order : {'C', 'F'}, optional Determines whether the array data should be viewed as in C (row-major) order or FORTRAN (column-major) order. @@ -113,16 +127,15 @@ Examples -------- - >>> a = np.array([[1,2], [3,4]]) - >>> a.reshape(4) - array([1, 2, 3, 4]) - >>> a.reshape(4, order='F') - array([1, 3, 2, 4]) - >>> a.reshape((4,1)) - array([[1], - [2], - [3], - [4]]) + >>> a = np.array([[1,2,3], [4,5,6]]) + >>> np.reshape(a, 6) + array([1, 2, 3, 4, 5, 6]) + >>> np.reshape(a, 6, order='F') + array([1, 4, 2, 5, 3, 6]) + >>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2 + array([[1, 2], + [3, 4], + [5, 6]]) """ try: @@ -236,9 +249,10 @@ def put(a, ind, v, mode='raise'): """ - Set a.flat[n] = v[n] for all n in ind. + Changes specific elements of one array by replacing from another array. - If `v` is shorter than `ind`, it will repeat. + Set `a`.flat[n] = `v`\\[n] for all n in `ind`. If `v` is shorter than + `ind`, it will repeat which is different than `a[ind]` = `v`. Parameters ---------- @@ -379,28 +393,29 @@ Parameters ---------- - a : array-like + a : array_like Array to be sorted. - axis : int, optional - Axis along which to sort. If not specified, the flattened array - is used. + axis : int or None, optional + Axis along which to sort. If None, the array is flattened before + sorting. The default is -1, which sorts along the last axis. kind : {'quicksort', 'mergesort', 'heapsort'}, optional - Sorting algorithm. + Sorting algorithm. Default is 'quicksort'. order : list, optional - When `a` is an ndarray with fields defined, this argument specifies - which fields to compare first, second, etc. Not all fields need be - specified. + When `a` is a structured array, this argument specifies which fields + to compare first, second, and so on. This list does not need to + include all of the fields. Returns ------- sorted_array : ndarray - Array of same type and shape as `a`. + Array of the same type and shape as `a`. See Also -------- + ndarray.sort : Method to sort an array in-place. argsort : Indirect sort. lexsort : Indirect stable sort on multiple keys. - searchsorted : Find keys in sorted array. + searchsorted : Find elements in a sorted array. Notes ----- @@ -425,16 +440,35 @@ Examples -------- - >>> a=np.array([[1,4],[3,1]]) - >>> a.sort(1) - >>> a + >>> a = np.array([[1,4],[3,1]]) + >>> np.sort(a) # sort along the last axis array([[1, 4], [1, 3]]) - >>> a.sort(0) - >>> a - array([[1, 3], - [1, 4]]) + >>> np.sort(a, axis=None) # sort the flattened array + array([1, 1, 3, 4]) + >>> np.sort(a, axis=0) # sort along the first axis + array([[1, 1], + [3, 4]]) + Use the `order` keyword to specify a field to use when sorting a + structured array: + + >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] + >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), + ... ('Galahad', 1.7, 38)] + >>> a = np.array(values, dtype=dtype) # create a structured array + >>> np.sort(a, order='height') # doctest: +SKIP + array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), + ('Lancelot', 1.8999999999999999, 38)], + dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP + array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), + ('Arthur', 1.8, 41)], + dtype=[('name', '|S10'), ('height', '>> np.shape(0) () - >>> x = np.array([(1,2),(3,4)], dtype=[('x', 'i4'), ('y', 'i4')]) - >>> np.shape(x) + >>> a = np.array([(1,2),(3,4)], dtype=[('x', 'i4'), ('y', 'i4')]) + >>> np.shape(a) (2,) - >>> x.shape + >>> a.shape (2,) """ @@ -1013,24 +1054,29 @@ Parameters ---------- - condition : {array} - Boolean 1-d array selecting which entries to return. If len(condition) - is less than the size of a along the axis, then output is truncated - to length of condition array. - a : {array_type} + condition : array_like + Boolean 1-D array selecting which entries to return. If len(condition) + is less than the size of `a` along the given axis, then output is + truncated to the length of the condition array. + a : array_like Array from which to extract a part. - axis : {None, integer} - Axis along which to take slices. If None, work on the flattened array. - out : array, optional + axis : int, optional + Axis along which to take slices. If None (default), work on the + flattened array. + out : ndarray, optional Output array. Its type is preserved and it must be of the right shape to hold the output. Returns ------- - compressed_array : array + compressed_array : ndarray A copy of `a` without the slices along axis for which `condition` is false. + See Also + -------- + ndarray.compress: Equivalent method. + Examples -------- >>> a = np.array([[1, 2], [3, 4]]) @@ -1127,7 +1173,7 @@ Returns ------- - sum_along_axis : ndarray or scalar + sum_along_axis : ndarray An array with the same shape as `a`, with the specified axis removed. If `a` is a 0-d array, or if `axis` is None, a scalar is returned. If an output array is specified, a reference to @@ -1208,14 +1254,11 @@ def alltrue (a, axis=None, out=None): """ - Check if all of the elements of `a` are true. + Check if all elements of input array are true. - Please refer to the `numpy.all` documentation. `numpy.all` is - the same function. - See Also -------- - numpy.all : equivalent function + numpy.all : Equivalent function; see for details. """ try: @@ -1227,7 +1270,7 @@ def any(a,axis=None, out=None): """ - Test whether any elements of an array evaluate to true along a given axis. + Test whether any elements of an array evaluate to True along an axis. Parameters ---------- @@ -1278,7 +1321,7 @@ def all(a,axis=None, out=None): """ - Test whether all elements of an array evaluate to true along a given axis. + Returns True if all elements evaluate to True. Parameters ---------- @@ -1293,7 +1336,7 @@ Returns ------- - out : ndarray + out : ndarray, bool A logical AND is performed along `axis`, and the result placed in `out`. If `out` was not specified, a new output array is created. @@ -1333,7 +1376,7 @@ Parameters ---------- - a : array-like + a : array_like Input array or object that can be converted to an array. axis : int, optional Axis along which the cumulative sum is computed. The default @@ -1403,8 +1446,10 @@ def ptp(a, axis=None, out=None): """ - Peak to peak (maximum - minimum) value along a given axis. + Range of values (maximum - minimum) along an axis. + The name of the function comes from the acronym for 'peak to peak'. + Parameters ---------- a : array_like @@ -1526,7 +1571,7 @@ def alen(a): """ - Return the length of an array_like as an array of at least 1 dimension. + Return the length of the first dimension of the input array. Parameters ---------- @@ -1538,12 +1583,16 @@ alen : int Length of the first dimension of `a`. + See Also + -------- + shape + Examples -------- - >>> z = np.zeros((7,4,5)) - >>> z.shape[0] + >>> a = np.zeros((7,4,5)) + >>> a.shape[0] 7 - >>> np.alen(z) + >>> np.alen(a) 7 """ @@ -1567,8 +1616,8 @@ dtype : data-type, optional The data-type of the returned array, as well as of the accumulator in which the elements are multiplied. By default, if `a` is of - integer type, `dtype` is the default platform integer (note: if - the type of `a` is unsigned, then so is `dtype`). Otherwise, + integer type, `dtype` is the default platform integer. (Note: if + the type of `a` is unsigned, then so is `dtype`.) Otherwise, the dtype is the same as that of `a`. out : ndarray, optional Alternative output array in which to place the result. It must have @@ -1577,7 +1626,7 @@ Returns ------- - product_along_axis : {ndarray, scalar}, see `dtype` parameter above. + product_along_axis : ndarray, see `dtype` parameter above. An array shaped as `a` but with the specified axis removed. Returns a reference to `out` if specified. @@ -1844,9 +1893,9 @@ Returns ------- - rounded_array : {array} + rounded_array : ndarray An array of the same type as `a`, containing the rounded values. - Unless `a` was specified, a new array is created. A reference to + Unless `out` was specified, a new array is created. A reference to the result is returned. The real and imaginary parts of complex numbers are rounded Modified: branches/1.2.x/numpy/core/numeric.py =================================================================== --- branches/1.2.x/numpy/core/numeric.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/core/numeric.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -305,7 +305,7 @@ Parameters ---------- - a : array-like + a : array_like Input array. dtype : data-type, optional By default, the data-type is inferred from the input data. @@ -339,7 +339,7 @@ Parameters ---------- - a : array-like + a : array_like The object to be converted to a type-and-requirement satisfying array dtype : data-type The required data-type (None is the default data-type -- float64) @@ -403,15 +403,42 @@ return a.flags.fnc def argwhere(a): - """Return a 2-d array of shape N x a.ndim where each row - is a sequence of indices into a. This sequence must be - converted to a tuple in order to be used to index into a. + """ + Find the indices of array elements that are non-zero, grouped by element. - >>> np.argwhere(np.ones((2, 2))) - array([[0, 0], - [0, 1], + Parameters + ---------- + a : array_like + Input data. + + Returns + ------- + index_array : ndarray + Indices of elements that are non-zero. Indices are grouped by element. + + See Also + -------- + where, nonzero + + Notes + ----- + ``np.argwhere(a)`` is the same as ``np.transpose(np.nonzero(a))``. + + The output of ``argwhere`` is not suitable for indexing arrays. + For this purpose use ``where(a)`` instead. + + Examples + -------- + >>> x = np.arange(6).reshape(2,3) + >>> x + array([[0, 1, 2], + [3, 4, 5]]) + >>> np.argwhere(x>1) + array([[0, 2], [1, 0], - [1, 1]]) + [1, 1], + [1, 2]]) + """ return asarray(a.nonzero()).T @@ -635,6 +662,13 @@ dot(`a`, `b`). If the first argument is complex the complex conjugate of the first argument is used for the calculation of the dot product. + For 2-D arrays it is equivalent to matrix multiplication, and for 1-D + arrays to inner product of vectors (with complex conjugation of `a`). + For N dimensions it is a sum product over the last axis of `a` and + the second-to-last of `b`:: + + dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) + Parameters ---------- a : array_like @@ -645,7 +679,7 @@ Returns ------- - output : scalar + output : ndarray Returns dot product of `a` and `b`. Can be an int, float, or complex depending on the types of `a` and `b`. @@ -726,7 +760,7 @@ def tensordot(a, b, axes=2): """ - Returns the tensor dot product for (ndim >= 1) arrays along specified axes. + Returns the tensor dot product for (ndim >= 1) arrays along an axes. The first element of the sequence determines the axis or axes in `a` to sum over, and the second element in `axes` argument sequence @@ -1109,40 +1143,52 @@ def indices(dimensions, dtype=int): """ - Return an array representing the coordinates of a grid. + Return an array representing the indices of a grid. + Compute an array where the subarrays contain index values 0,1,... + varying only along the corresponding axis. + Parameters ---------- - shape : (N,) tuple of ints + dimensions : sequence of ints + The shape of the grid. + dtype : optional + Data_type of the result. Returns ------- grid : ndarray - The output shape is ``(N,) + shape``. I.e., if `shape` is ``(2,4,5)``, - the output shape is ``(3, 2, 4, 5)``. Each subarray, ``grid[i,...]`` - contains values that vary only along the ``i-th`` axis. + The array of grid indices, + ``grid.shape = (len(dimensions),) + tuple(dimensions)``. + See Also + -------- + mgrid, meshgrid + + Notes + ----- + The output shape is obtained by prepending the number of dimensions + in front of the tuple of dimensions, i.e. if `dimensions` is a tuple + ``(r0, ..., rN-1)`` of length ``N``, the output shape is + ``(N,r0,...,rN-1)``. + + The subarrays ``grid[k]`` contains the N-D array of indices along the + ``k-th`` axis. Explicitly:: + + grid[k,i0,i1,...,iN-1] = ik + Examples -------- >>> grid = np.indices((2,3)) - - The row-positions are given by: - - >>> grid[0] + >>> grid.shape + (2,2,3) + >>> grid[0] # row indices array([[0, 0, 0], [1, 1, 1]]) - - and the column-positions by - - >>> grid[1] + >>> grid[1] # column indices array([[0, 1, 2], [0, 1, 2]]) - - See Also - -------- - mgrid, meshgrid, ndindex - """ dimensions = tuple(dimensions) N = len(dimensions) @@ -1491,7 +1537,7 @@ def allclose(a, b, rtol=1.e-5, atol=1.e-8): """ - Returns True if all elements are equal subject to given tolerances. + Returns True if two arrays are element-wise equal within a tolerance. The tolerance values are positive, typically very small numbers. The relative difference (`rtol` * `b`) and the absolute difference (`atol`) @@ -1507,18 +1553,34 @@ atol : Absolute tolerance The absolute difference is equal to `atol`. + Returns + ------- + y : bool + Returns True if the two arrays are equal within the given + tolerance; False otherwise. If either array contains NaN, then + False is returned. + See Also -------- all, any, alltrue, sometrue + Notes + ----- + If the following equation is element-wise True, then allclose returns + True. + + absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) + Examples -------- - >>> allclose(array([1e10,1e-7]), array([1.00001e10,1e-8])) + >>> np.allclose([1e10,1e-7], [1.00001e10,1e-8]) False - >>> allclose(array([1e10,1e-8]), array([1.00001e10,1e-9])) + >>> np.allclose([1e10,1e-8], [1.00001e10,1e-9]) True - >>> allclose(array([1e10,1e-8]), array([1.0001e10,1e-9])) + >>> np.allclose([1e10,1e-8], [1.0001e10,1e-9]) False + >>> np.allclose([1.0, np.nan], [1.0, np.nan]) + False """ x = array(a, copy=False) @@ -1540,9 +1602,9 @@ Parameters ---------- - a1 : array-like + a1 : array_like First input array. - a2 : array-like + a2 : array_like Second input array. Returns @@ -1571,10 +1633,33 @@ return bool(logical_and.reduce(equal(a1,a2).ravel())) def array_equiv(a1, a2): - """Returns True if a1 and a2 are shape consistent - (mutually broadcastable) and have all elements equal and False - otherwise. """ + Returns True if input arrays are shape consistent and all elements equal. + + Parameters + ---------- + a1 : array_like + Input array. + a2 : array_like + Input array. + + Returns + ------- + out : bool + True if equivalent, False otherwise. + + Examples + -------- + >>> np.array_equiv([1,2],[1,2]) + >>> True + >>> np.array_equiv([1,2],[1,3]) + >>> False + >>> np.array_equiv([1,2], [[1,2],[1,2]]) + >>> True + >>> np.array_equiv([1,2], [[1,2],[1,3]]) + >>> False + + """ try: a1, a2 = asarray(a1), asarray(a2) except: @@ -1598,31 +1683,73 @@ del key def seterr(all=None, divide=None, over=None, under=None, invalid=None): - """Set how floating-point errors are handled. + """ + Set how floating-point errors are handled. - Valid values for each type of error are the strings - "ignore", "warn", "raise", and "call". Returns the old settings. - If 'all' is specified, values that are not otherwise specified - will be set to 'all', otherwise they will retain their old - values. - Note that operations on integer scalar types (such as int16) are handled like floating point, and are affected by these settings. - Example: + Parameters + ---------- + all : {'ignore', 'warn', 'raise', 'call'}, optional + Set treatment for all types of floating-point errors at once: + - ignore: Take no action when the exception occurs + - warn: Print a RuntimeWarning (via the Python `warnings` module) + - raise: Raise a FloatingPointError + - call: Call a function specified using the `seterrcall` function. + + The default is not to change the current behavior. + divide : {'ignore', 'warn', 'raise', 'call'}, optional + Treatment for division by zero. + over : {'ignore', 'warn', 'raise', 'call'}, optional + Treatment for floating-point overflow. + under : {'ignore', 'warn', 'raise', 'call'}, optional + Treatment for floating-point underflow. + invalid : {'ignore', 'warn', 'raise', 'call'}, optional + Treatment for invalid floating-point operation. + + Returns + ------- + old_settings : dict + Dictionary containing the old settings. + + See also + -------- + seterrcall : set a callback function for the 'call' mode. + geterr, geterrcall + + Notes + ----- + The floating-point exceptions are defined in the IEEE 754 standard [1]: + + - Division by zero: infinite result obtained from finite numbers. + - Overflow: result too large to be expressed. + - Underflow: result so close to zero that some precision + was lost. + - Invalid operation: result is not an expressible number, typically + indicates that a NaN was produced. + + .. [1] http://en.wikipedia.org/wiki/IEEE_754 + + Examples + -------- + + Set mode: + >>> seterr(over='raise') # doctest: +SKIP - {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'} + {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', + 'under': 'ignore'} - >>> seterr(all='warn', over='raise') # doctest: +SKIP - {'over': 'raise', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'} + >>> old_settings = seterr(all='warn', over='raise') # doctest: +SKIP >>> int16(32000) * int16(3) # doctest: +SKIP Traceback (most recent call last): File "", line 1, in ? FloatingPointError: overflow encountered in short_scalars >>> seterr(all='ignore') # doctest: +SKIP - {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'} + {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', + 'under': 'ignore'} """ @@ -1665,8 +1792,15 @@ return res def setbufsize(size): - """Set the size of the buffer used in ufuncs. """ + Set the size of the buffer used in ufuncs. + + Parameters + ---------- + size : int + Size of buffer. + + """ if size > 10e6: raise ValueError, "Buffer size, %s, is too big." % size if size < 5: Modified: branches/1.2.x/numpy/core/numerictypes.py =================================================================== --- branches/1.2.x/numpy/core/numerictypes.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/core/numerictypes.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -662,7 +662,8 @@ def find_common_type(array_types, scalar_types): - """Determine common type following standard coercion rules + """ + Determine common type following standard coercion rules Parameters ---------- @@ -679,6 +680,11 @@ is of a different kind. If the kinds is not understood, then None is returned. + + See Also + -------- + dtype + """ array_types = [dtype(x) for x in array_types] scalar_types = [dtype(x) for x in scalar_types] Modified: branches/1.2.x/numpy/doc/basics.py =================================================================== --- branches/1.2.x/numpy/doc/basics.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/doc/basics.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -132,6 +132,4 @@ value is inside an array or not. NumPy scalars also have many of the same methods arrays do. -See xxx for details. - """ Modified: branches/1.2.x/numpy/doc/creation.py =================================================================== --- branches/1.2.x/numpy/doc/creation.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/doc/creation.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -1,6 +1,6 @@ """ ============== -Array creation +Array Creation ============== Introduction @@ -18,17 +18,15 @@ expanding or mutating existing arrays. Nor will it cover creating object arrays or record arrays. Both of those are covered in their own sections. -Converting Python array-like objects to numpy arrays +Converting Python array_like Objects to Numpy Arrays ==================================================== In general, numerical data arranged in an array-like structure in Python can be converted to arrays through the use of the array() function. The most obvious examples are lists and tuples. See the documentation for array() for details for -its use. Some -objects may support the array-protocol and allow conversion to arrays this -way. A simple way to find out if the object can be converted to a numpy array -using array() is simply to try it interactively and see if it works! (The -Python Way). +its use. Some objects may support the array-protocol and allow conversion to arrays +this way. A simple way to find out if the object can be converted to a numpy array +using array() is simply to try it interactively and see if it works! (The Python Way). Examples: :: @@ -37,7 +35,7 @@ >>> x = np.array([[1,2.0],[0,0],(1+1j,3.)]) # note mix of tuple and lists, and types >>> x = np.array([[ 1.+0.j, 2.+0.j], [ 0.+0.j, 0.+0.j], [ 1.+1.j, 3.+0.j]]) -Intrinsic numpy array creation +Intrinsic Numpy Array Creation ============================== Numpy has built-in functions for creating arrays from scratch: @@ -65,6 +63,17 @@ Note that there are some subtleties regarding the last usage that the user should be aware of that are described in the arange docstring. +linspace() will create arrays with a specified number of elements, and +spaced equally between the specified beginning and end values. For +example: :: + + >>> np.linspace(1., 4., 6) + array([ 1. , 1.6, 2.2, 2.8, 3.4, 4. ]) + +The advantage of this creation function is that one can guarantee the +number of elements and the starting and end point, which arange() +generally will not do for arbitrary start, stop, and step values. + indices() will create a set of arrays (stacked as a one-higher dimensioned array), one per dimension with each representing variation in that dimension. An examples illustrates much better than a verbal description: :: @@ -75,41 +84,41 @@ This is particularly useful for evaluating functions of multiple dimensions on a regular grid. -Reading arrays from disk +Reading Arrays From Disk ======================== This is presumably the most common case of large array creation. The details, of course, depend greatly on the format of data on disk and so this section can only give general pointers on how to handle various formats. -Standard binary formats +Standard Binary Formats ----------------------- Various fields have standard formats for array data. The following lists the ones with known python libraries to read them and return numpy arrays (there may be others for which it is possible to read and convert to numpy arrays so check the last section as well) +:: -HDF5: PyTables -FITS: PyFITS -Others? xxx + HDF5: PyTables + FITS: PyFITS + Others? xxx Examples of formats that cannot be read directly but for which it is not hard to convert are libraries like PIL (able to read and write many image formats such as jpg, png, etc). -Common ascii formats --------------------- +Common ASCII Formats +------------------------ Comma Separated Value files (CSV) are widely used (and an export and import option for programs like Excel). There are a number of ways of reading these -files in Python. The most convenient ways of reading these are found in pylab -(part of matplotlib) in the xxx function. (list alternatives xxx) +files in Python. There are CSV functions in Python and functions in pylab +(part of matplotlib). -More generic ascii files can be read using the io package in scipy. xxx a few -more details needed... +More generic ascii files can be read using the io package in scipy. -Custom binary formats +Custom Binary Formats --------------------- There are a variety of approaches one can use. If the file has a relatively @@ -120,13 +129,13 @@ xxx) though that certainly is much more work and requires significantly more advanced knowledge to interface with C or C++. -Use of special libraries +Use of Special Libraries ------------------------ There are libraries that can be used to generate arrays for special purposes and it isn't possible to enumerate all of them. The most common uses are use of the many array generation functions in random that can generate arrays of random values, and some utility functions to generate special matrices (e.g. -diagonal, see xxx) +diagonal) """ Modified: branches/1.2.x/numpy/doc/glossary.py =================================================================== --- branches/1.2.x/numpy/doc/glossary.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/doc/glossary.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -1,7 +1,7 @@ """ -================= +======== Glossary -================= +======== along an axis Axes are defined for arrays with more than one dimension. A @@ -23,7 +23,7 @@ >>> x.sum(axis=1) array([ 6, 22, 38]) -array or ndarray +array A homogeneous container of numerical elements. Each element in the array occupies a fixed amount of memory (hence homogeneous), and can be a numerical element of a single type (such as float, int @@ -60,6 +60,9 @@ >>> x.shape (3,) +BLAS + `Basic Linear Algebra Subprograms `_ + broadcast NumPy can do operations on arrays whose shapes are mismatched:: @@ -79,6 +82,24 @@ See `doc.broadcasting`_ for more information. +C order + See `row-major` + +column-major + A way to represent items in a N-dimensional array in the 1-dimensional + computer memory. In column-major order, the leftmost index "varies the + fastest": for example the array:: + + [[1, 2, 3], + [4, 5, 6]] + + is represented in the column-major order as:: + + [1, 4, 2, 5, 3, 6] + + Column-major order is also known as the Fortran order, as the Fortran + programming language uses it. + decorator An operator that transforms a function. For example, a ``log`` decorator may be defined to print debugging information upon @@ -128,6 +149,12 @@ For more information on dictionaries, read the `Python tutorial `_. +Fortran order + See `column-major` + +flattened + Collapsed to a one-dimensional array. See `ndarray.flatten`_ for details. + immutable An object that cannot be modified after execution is called immutable. Two common examples are strings and tuples. @@ -250,10 +277,28 @@ >>> x.repeat(2) array([1, 1, 2, 2, 3, 3]) +ndarray + See *array*. + reference If ``a`` is a reference to ``b``, then ``(a is b) == True``. Therefore, ``a`` and ``b`` are different names for the same Python object. +row-major + A way to represent items in a N-dimensional array in the 1-dimensional + computer memory. In row-major order, the rightmost index "varies + the fastest": for example the array:: + + [[1, 2, 3], + [4, 5, 6]] + + is represented in the row-major order as:: + + [1, 2, 3, 4, 5, 6] + + Row-major order is also known as the C order, as the C programming + language uses it. New Numpy arrays are by default in row-major order. + self Often seen in method signatures, ``self`` refers to the instance of the associated class. For example: Modified: branches/1.2.x/numpy/doc/misc.py =================================================================== --- branches/1.2.x/numpy/doc/misc.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/doc/misc.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -1,9 +1,223 @@ """ - ============= Miscellaneous ============= -Placeholder for other tips. +IEEE 754 Floating Point Special Values: +----------------------------------------------- +Special values defined in numpy: nan, inf, + +NaNs can be used as a poor-man's mask (if you don't care what the +original value was) + +Note: cannot use equality to test NaNs. E.g.: :: + + >>> np.where(myarr == np.nan) + >>> nan == nan # is always False! Use special numpy functions instead. + + >>> np.nan == np.nan + False + >>> myarr = np.array([1., 0., np.nan, 3.]) + >>> myarr[myarr == np.nan] = 0. # doesn't work + >>> myarr + array([ 1., 0., NaN, 3.]) + >>> myarr[np.isnan(myarr)] = 0. # use this instead find + >>> myarr + array([ 1., 0., 0., 3.]) + +Other related special value functions: :: + + isinf(): True if value is inf + isfinite(): True if not nan or inf + nan_to_num(): Map nan to 0, inf to max float, -inf to min float + +The following corresponds to the usual functions except that nans are excluded from +the results: :: + + nansum() + nanmax() + nanmin() + nanargmax() + nanargmin() + + >>> x = np.arange(10.) + >>> x[3] = np.nan + >>> x.sum() + nan + >>> np.nansum(x) + 42.0 + +How numpy handles numerical exceptions + +Default is to "warn" +But this can be changed, and it can be set individually for different kinds +of exceptions. The different behaviors are: :: + + 'ignore' : ignore completely + 'warn' : print a warning (once only) + 'raise' : raise an exception + 'call' : call a user-supplied function (set using seterrcall()) + +These behaviors can be set for all kinds of errors or specific ones: :: + + all: apply to all numeric exceptions + invalid: when NaNs are generated + divide: divide by zero (for integers as well!) + overflow: floating point overflows + underflow: floating point underflows + +Note that integer divide-by-zero is handled by the same machinery. +These behaviors are set on a per-thead basis. + +Examples: +------------ + +:: + + >>> oldsettings = np.seterr(all='warn') + >>> np.zeros(5,dtype=np.float32)/0. + invalid value encountered in divide + >>> j = np.seterr(under='ignore') + >>> np.array([1.e-100])**10 + >>> j = np.seterr(invalid='raise') + >>> np.sqrt(np.array([-1.])) + FloatingPointError: invalid value encountered in sqrt + >>> def errorhandler(errstr, errflag): + ... print "saw stupid error!" + >>> np.seterrcall(errorhandler) + >>> j = np.seterr(all='call') + >>> np.zeros(5, dtype=np.int32)/0 + FloatingPointError: invalid value encountered in divide + saw stupid error! + >>> j = np.seterr(**oldsettings) # restore previous + # error-handling settings + +Interfacing to C: +----------------- +Only a survey the choices. Little detail on how each works. + +1) Bare metal, wrap your own C-code manually. + + - Plusses: + + - Efficient + - No dependencies on other tools + + - Minuses: + + - Lots of learning overhead: + + - need to learn basics of Python C API + - need to learn basics of numpy C API + - need to learn how to handle reference counting and love it. + + - Reference counting often difficult to get right. + + - getting it wrong leads to memory leaks, and worse, segfaults + + - API will change for Python 3.0! + +2) pyrex + + - Plusses: + + - avoid learning C API's + - no dealing with reference counting + - can code in psuedo python and generate C code + - can also interface to existing C code + - should shield you from changes to Python C api + - become pretty popular within Python community + + - Minuses: + + - Can write code in non-standard form which may become obsolete + - Not as flexible as manual wrapping + - Maintainers not easily adaptable to new features + +Thus: + +3) cython - fork of pyrex to allow needed features for SAGE + + - being considered as the standard scipy/numpy wrapping tool + - fast indexing support for arrays + +4) ctypes + + - Plusses: + + - part of Python standard library + - good for interfacing to existing sharable libraries, particularly + Windows DLLs + - avoids API/reference counting issues + - good numpy support: arrays have all these in their ctypes + attribute: :: + + a.ctypes.data a.ctypes.get_strides + a.ctypes.data_as a.ctypes.shape + a.ctypes.get_as_parameter a.ctypes.shape_as + a.ctypes.get_data a.ctypes.strides + a.ctypes.get_shape a.ctypes.strides_as + + - Minuses: + + - can't use for writing code to be turned into C extensions, only a wrapper tool. + +5) SWIG (automatic wrapper generator) + + - Plusses: + + - around a long time + - multiple scripting language support + - C++ support + - Good for wrapping large (many functions) existing C libraries + + - Minuses: + + - generates lots of code between Python and the C code + + - can cause performance problems that are nearly impossible to optimize out + + - interface files can be hard to write + - doesn't necessarily avoid reference counting issues or needing to know API's + +7) Weave + + - Plusses: + + - Phenomenal tool + - can turn many numpy expressions into C code + - dynamic compiling and loading of generated C code + - can embed pure C code in Python module and have weave extract, generate interfaces + and compile, etc. + + - Minuses: + + - Future uncertain--lacks a champion + +8) Psyco + + - Plusses: + + - Turns pure python into efficient machine code through jit-like optimizations + - very fast when it optimizes well + + - Minuses: + + - Only on intel (windows?) + - Doesn't do much for numpy? + +Interfacing to Fortran: +----------------------- +Fortran: Clear choice is f2py. (Pyfort is an older alternative, but not supported +any longer) + +Interfacing to C++: +------------------- +1) CXX +2) Boost.python +3) SWIG +4) Sage has used cython to wrap C++ (not pretty, but it can be done) +5) SIP (used mainly in PyQT) + """ Modified: branches/1.2.x/numpy/doc/subclassing.py =================================================================== --- branches/1.2.x/numpy/doc/subclassing.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/doc/subclassing.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -20,17 +20,17 @@ ndarrays and object creation ============================ The creation of ndarrays is complicated by the need to return views of -ndarrays, that are also ndarrays. For example:: +ndarrays, that are also ndarrays. For example: - >>> import numpy as np - >>> arr = np.zeros((3,)) - >>> type(arr) - - >>> v = arr[1:] - >>> type(v) - - >>> v is arr - False +>>> import numpy as np +>>> arr = np.zeros((3,)) +>>> type(arr) + +>>> v = arr[1:] +>>> type(v) + +>>> v is arr +False So, when we take a view (here a slice) from the ndarray, we return a new ndarray, that points to the data in the original. When we @@ -148,6 +148,7 @@ ----------------------------------------------------- :: + import numpy as np class InfoArray(np.ndarray): Modified: branches/1.2.x/numpy/fft/fftpack.py =================================================================== --- branches/1.2.x/numpy/fft/fftpack.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/fft/fftpack.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -109,24 +109,27 @@ def ifft(a, n=None, axis=-1): """ - Compute the one-dimensonal inverse fft on a given axis. + Compute the one-dimensonal inverse fft along an axis. - Return the n point inverse discrete Fourier transform of a. n - defaults to the length of a. If n is larger than the length of a, - then a will be zero-padded to make up the difference. If n is - smaller than the length of a, then a will be truncated to reduce - its size. + Return the `n` point inverse discrete Fourier transform of `a`. The length + `n` defaults to the length of `a`. If `n` is larger than the length of `a`, + then `a` will be zero-padded to make up the difference. If `n` is smaller + than the length of `a`, then `a` will be truncated to reduce its size. Parameters ---------- - a : array - input array - n : int - length of the fft - axis : int - axis over which to compute the inverse fft + a : array_like + Input array. + n : int, optional + Length of the fft. + axis : int, optional + Axis over which to compute the inverse fft. + See Also + -------- + fft + Notes ----- The input array is expected to be packed the same way as the output of @@ -135,10 +138,10 @@ This is the inverse of fft: ifft(fft(a)) == a within numerical accuracy. - This is most efficient for n a power of two. This also stores a cache of + This is most efficient for `n` a power of two. This also stores a cache of working memory for different sizes of fft's, so you could theoretically run into memory problems if you call this too many times with too many - different n's. + different `n` values. """ @@ -189,35 +192,36 @@ """ Compute the one-dimensional inverse fft for real input. - Notes - ----- - - Return the real valued n point inverse discrete Fourier transform - of a, where a contains the nonnegative frequency terms of a - Hermite-symmetric sequence. n is the length of the result, not the - input. If n is not supplied, the default is 2*(len(a)-1). If you - want the length of the result to be odd, you have to say so. - Parameters ---------- - a : array - input array with real data type + Input array with real data type. n : int - length of the fft + Length of the fft. axis : int - axis over which to compute the fft + Axis over which to compute the fft. + See Also + -------- + rfft + Notes ----- + Return the real valued `n` point inverse discrete Fourier transform + of `a`, where `a` contains the nonnegative frequency terms of a + Hermite-symmetric sequence. `n` is the length of the result, not the + input. If `n` is not supplied, the default is 2*(len(`a`)-1). If you + want the length of the result to be odd, you have to say so. - If you specify an n such that a must be zero-padded or truncated, the + If you specify an `n` such that `a` must be zero-padded or truncated, the extra/removed values will be added/removed at high frequencies. One can thus resample a series to m points via Fourier interpolation by: a_resamp = irfft(rfft(a), m). - This is the inverse of rfft: irfft(rfft(a), len(a)) == a within numerical accuracy. + Within numerical accuracy ``irfft`` is the inverse of ``rfft``:: + irfft(rfft(a), len(a)) == a + """ a = asarray(a).astype(complex) @@ -240,6 +244,11 @@ axis : int axis over which to compute the hfft + See also + -------- + rfft + ihfft + Notes ----- These are a pair analogous to rfft/irfft, but for the @@ -250,11 +259,6 @@ ihfft(hfft(a), len(a)) == a within numerical accuracy. - See also - -------- - rfft - ihfft - """ a = asarray(a).astype(complex) @@ -265,18 +269,21 @@ def ihfft(a, n=None, axis=-1): """ - Compute the inverse fft of a signal which spectrum has Hermitian - symmetry. + Compute the inverse fft of a signal whose spectrum has Hermitian symmetry. Parameters ---------- - a : array - input array - n : int - length of the ihfft - axis : int - axis over which to compute the ihfft + a : array_like + Input array. + n : int, optional + Length of the ihfft. + axis : int, optional + Axis over which to compute the ihfft. + See also + -------- + rfft, hfft + Notes ----- These are a pair analogous to rfft/irfft, but for the @@ -287,11 +294,6 @@ ihfft(hfft(a), len(a)) == a within numerical accuracy. - See also - -------- - rfft - hfft - """ a = asarray(a).astype(float) @@ -395,20 +397,21 @@ def fft2(a, s=None, axes=(-2,-1)): """ - Compute the 2d fft of an array. + Compute the 2-D FFT of an array. Parameters ---------- - a : array - input array - s : sequence (int) - shape of the fft - axis : int - axis over which to compute the fft + a : array_like + Input array. The rank (dimensions) of `a` must be 2 or greater. + s : shape tuple + Shape of the FFT. + axes : sequence of 2 ints + The 2 axes over which to compute the FFT. The default is the last two + axes (-2, -1). Notes ----- - This is really just fftn with different default behavior. + This is really just ``fftn`` with different default behavior. """ Modified: branches/1.2.x/numpy/fft/helper.py =================================================================== --- branches/1.2.x/numpy/fft/helper.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/fft/helper.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -10,14 +10,23 @@ import types def fftshift(x,axes=None): - """ fftshift(x, axes=None) -> y - + """ Shift zero-frequency component to center of spectrum. This function swaps half-spaces for all axes listed (defaults to all). + If len(x) is even then the Nyquist component is y[0]. - Notes: - If len(x) is even then the Nyquist component is y[0]. + Parameters + ---------- + x : array_like + Input array. + axes : int or shape tuple, optional + Axes over which to shift. Default is None which shifts all axes. + + See Also + -------- + ifftshift + """ tmp = asarray(x) ndim = len(tmp.shape) @@ -33,9 +42,20 @@ def ifftshift(x,axes=None): - """ ifftshift(x,axes=None) - > y + """ + Inverse of fftshift. - Inverse of fftshift. + Parameters + ---------- + x : array_like + Input array. + axes : int or shape tuple, optional + Axes over which to calculate. Defaults to None which is over all axes. + + See Also + -------- + fftshift + """ tmp = asarray(x) ndim = len(tmp.shape) @@ -50,16 +70,39 @@ return y def fftfreq(n,d=1.0): - """ fftfreq(n, d=1.0) -> f + """ + Discrete Fourier Transform sample frequencies. - DFT sample frequencies - The returned float array contains the frequency bins in - cycles/unit (with zero at the start) given a window length n and a - sample spacing d: + cycles/unit (with zero at the start) given a window length `n` and a + sample spacing `d`. + :: f = [0,1,...,n/2-1,-n/2,...,-1]/(d*n) if n is even f = [0,1,...,(n-1)/2,-(n-1)/2,...,-1]/(d*n) if n is odd + + Parameters + ---------- + n : int + Window length. + d : scalar + Sample spacing. + + Returns + ------- + out : ndarray, shape(`n`,) + Sample frequencies. + + Examples + -------- + >>> signal = np.array([-2., 8., -6., 4., 1., 0., 3., 5.]) + >>> fourier = np.fft.fft(signal) + >>> n = len(signal) + >>> timestep = 0.1 + >>> freq = np.fft.fftfreq(n, d=timestep) + >>> freq + array([ 0. , 1.25, 2.5 , 3.75, -5. , -3.75, -2.5 , -1.25]) + """ assert isinstance(n,types.IntType) or isinstance(n, integer) val = 1.0/(n*d) Modified: branches/1.2.x/numpy/lib/__init__.py =================================================================== --- branches/1.2.x/numpy/lib/__init__.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/__init__.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -1,3 +1,151 @@ +""" +Basic functions used by several sub-packages and +useful to have in the main name-space. + +Type Handling +------------- +================ =================== +iscomplexobj Test for complex object, scalar result +isrealobj Test for real object, scalar result +iscomplex Test for complex elements, array result +isreal Test for real elements, array result +imag Imaginary part +real Real part +real_if_close Turns complex number with tiny imaginary part to real +isneginf Tests for negative infinity, array result +isposinf Tests for positive infinity, array result +isnan Tests for nans, array result +isinf Tests for infinity, array result +isfinite Tests for finite numbers, array result +isscalar True if argument is a scalar +nan_to_num Replaces NaN's with 0 and infinities with large numbers +cast Dictionary of functions to force cast to each type +common_type Determine the minimum common type code for a group + of arrays +mintypecode Return minimal allowed common typecode. +================ =================== + +Index Tricks +------------ +================ =================== +mgrid Method which allows easy construction of N-d + 'mesh-grids' +``r_`` Append and construct arrays: turns slice objects into + ranges and concatenates them, for 2d arrays appends rows. +index_exp Konrad Hinsen's index_expression class instance which + can be useful for building complicated slicing syntax. +================ =================== + +Useful Functions +---------------- +================ =================== +select Extension of where to multiple conditions and choices +extract Extract 1d array from flattened array according to mask +insert Insert 1d array of values into Nd array according to mask +linspace Evenly spaced samples in linear space +logspace Evenly spaced samples in logarithmic space +fix Round x to nearest integer towards zero +mod Modulo mod(x,y) = x % y except keeps sign of y +amax Array maximum along axis +amin Array minimum along axis +ptp Array max-min along axis +cumsum Cumulative sum along axis +prod Product of elements along axis +cumprod Cumluative product along axis +diff Discrete differences along axis +angle Returns angle of complex argument +unwrap Unwrap phase along given axis (1-d algorithm) +sort_complex Sort a complex-array (based on real, then imaginary) +trim_zeros Trim the leading and trailing zeros from 1D array. +vectorize A class that wraps a Python function taking scalar + arguments into a generalized function which can handle + arrays of arguments using the broadcast rules of + numerix Python. +================ =================== + +Shape Manipulation +------------------ +================ =================== +squeeze Return a with length-one dimensions removed. +atleast_1d Force arrays to be > 1D +atleast_2d Force arrays to be > 2D +atleast_3d Force arrays to be > 3D +vstack Stack arrays vertically (row on row) +hstack Stack arrays horizontally (column on column) +column_stack Stack 1D arrays as columns into 2D array +dstack Stack arrays depthwise (along third dimension) +split Divide array into a list of sub-arrays +hsplit Split into columns +vsplit Split into rows +dsplit Split along third dimension +================ =================== + +Matrix (2D Array) Manipulations +------------------------------- +================ =================== +fliplr 2D array with columns flipped +flipud 2D array with rows flipped +rot90 Rotate a 2D array a multiple of 90 degrees +eye Return a 2D array with ones down a given diagonal +diag Construct a 2D array from a vector, or return a given + diagonal from a 2D array. +mat Construct a Matrix +bmat Build a Matrix from blocks +================ =================== + +Polynomials +----------- +================ =================== +poly1d A one-dimensional polynomial class +poly Return polynomial coefficients from roots +roots Find roots of polynomial given coefficients +polyint Integrate polynomial +polyder Differentiate polynomial +polyadd Add polynomials +polysub Substract polynomials +polymul Multiply polynomials +polydiv Divide polynomials +polyval Evaluate polynomial at given argument +================ =================== + +Import Tricks +------------- +================ =================== +ppimport Postpone module import until trying to use it +ppimport_attr Postpone module import until trying to use its attribute +ppresolve Import postponed module and return it. +================ =================== + +Machine Arithmetics +------------------- +================ =================== +machar_single Single precision floating point arithmetic parameters +machar_double Double precision floating point arithmetic parameters +================ =================== + +Threading Tricks +---------------- +================ =================== +ParallelExec Execute commands in parallel thread. +================ =================== + +1D Array Set Operations +----------------------- +Set operations for 1D numeric arrays based on sort() function. + +================ =================== +ediff1d Array difference (auxiliary function). +unique1d Unique elements of 1D array. +intersect1d Intersection of 1D arrays with unique elements. +intersect1d_nu Intersection of 1D arrays with any elements. +setxor1d Set exclusive-or of 1D arrays with unique elements. +setmember1d Return an array of shape of ar1 containing 1 where + the elements of ar1 are in ar2 and 0 otherwise. +union1d Union of 1D arrays with unique elements. +setdiff1d Set difference of 1D arrays with unique elements. +================ =================== + +""" from info import __doc__ from numpy.version import version as __version__ Modified: branches/1.2.x/numpy/lib/_datasource.py =================================================================== --- branches/1.2.x/numpy/lib/_datasource.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/_datasource.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -275,27 +275,29 @@ return None def abspath(self, path): - """Return absolute path of ``path`` in the DataSource directory. + """ + Return absolute path of file in the DataSource directory. - If ``path`` is an URL, the ``abspath`` will be either the location + If `path` is an URL, the ``abspath`` will be either the location the file exists locally or the location it would exist when opened using the ``open`` method. The functionality is idential to os.path.abspath. - *Parameters*: + Parameters + ---------- + path : string + Can be a local file or a remote URL. - path : {string} - Can be a local file or a remote URL. - - *Returns*: - + Returns + ------- + out : string Complete path, rooted in the DataSource destination directory. - *See Also*: + See Also + -------- + open - `open` : Method that downloads and opens files. - """ # We do this here to reduce the 'import numpy' initial import time. from urlparse import urlparse @@ -332,9 +334,10 @@ return path def exists(self, path): - """Test if ``path`` exists. + """ + Test if path exists. - Test if ``path`` exists as (and in this order): + Test if `path` exists as (and in this order): - a local file. - a remote URL that have been downloaded and stored locally in the @@ -342,26 +345,27 @@ - a remote URL that has not been downloaded, but is valid and accessible. - *Parameters*: + Parameters + ---------- + path : string + Can be a local file or a remote URL. - path : {string} - Can be a local file or a remote URL. + Returns + ------- + out : bool + True if `path` exists. - *Returns*: + See Also + -------- + abspath - boolean + Notes + ----- + When `path` is an URL, ``exist`` will return True if it's either stored + locally in the DataSource directory, or is a valid remote URL. DataSource + does not discriminate between to two, the file is accessible if it exists + in either location. - *See Also*: - - `abspath` - - *Notes* - - When ``path`` is an URL, ``exist`` will return True if it's either - stored locally in the DataSource directory, or is a valid remote - URL. DataSource does not discriminate between to two, the file - is accessible if it exists in either location. - """ # We import this here because importing urllib2 is slow and # a significant fraction of numpy's total import time. @@ -387,22 +391,26 @@ return False def open(self, path, mode='r'): - """Open ``path`` with ``mode`` and return the file object. + """ + Open and return file-like object. If ``path`` is an URL, it will be downloaded, stored in the DataSource directory and opened from there. - *Parameters*: + Parameters + ---------- + path : string + Local file path or URL to open + mode : {'r', 'w', 'a'}, optional + Mode to open `path`. Mode 'r' for reading, 'w' for writing, 'a' to + append. Available modes depend on the type of object specified by + `path`. - path : {string} + Returns + ------- + out : file object + File object. - mode : {string}, optional - - - *Returns*: - - file object - """ # TODO: There is no support for opening a file for writing which @@ -476,19 +484,106 @@ return DataSource._findfile(self, self._fullpath(path)) def abspath(self, path): - """Extend DataSource method to prepend baseurl to ``path``.""" + """ + Return absolute path of file in the Repository directory. + + If `path` is an URL, the ``abspath`` will be either the location + the file exists locally or the location it would exist when opened + using the ``open`` method. + + The functionality is idential to os.path.abspath. + + Parameters + ---------- + path : string + Can be a local file or a remote URL. + + Returns + ------- + out : string + Complete path, rooted in the DataSource destination directory. + + See Also + -------- + open + + """ return DataSource.abspath(self, self._fullpath(path)) def exists(self, path): - """Extend DataSource method to prepend baseurl to ``path``.""" + """ + Test if path exists prepending Repository base URL to path. + + Test if `path` exists as (and in this order): + + - a local file. + - a remote URL that have been downloaded and stored locally in the + DataSource directory. + - a remote URL that has not been downloaded, but is valid and + accessible. + + Parameters + ---------- + path : string + Can be a local file or a remote URL. + + Returns + ------- + out : bool + True if `path` exists. + + See Also + -------- + abspath + + Notes + ----- + When `path` is an URL, ``exist`` will return True if it's either stored + locally in the DataSource directory, or is a valid remote URL. DataSource + does not discriminate between to two, the file is accessible if it exists + in either location. + + """ return DataSource.exists(self, self._fullpath(path)) def open(self, path, mode='r'): - """Extend DataSource method to prepend baseurl to ``path``.""" + """ + Open and return file-like object prepending Repository base URL. + + If `path` is an URL, it will be downloaded, stored in the DataSource + directory and opened from there. + + Parameters + ---------- + path : string + Local file path or URL to open + mode : {'r', 'w', 'a'}, optional + Mode to open `path`. Mode 'r' for reading, 'w' for writing, 'a' to + append. Available modes depend on the type of object specified by + `path`. + + Returns + ------- + out : file object + File object. + + """ return DataSource.open(self, self._fullpath(path), mode) def listdir(self): - '''List files in the source Repository.''' + """ + List files in the source Repository. + + Returns + ------- + files : list of str + List of file names (not containing a directory part). + + Notes + ----- + Does not currently work for remote repositories. + + """ if self._isurl(self._baseurl): raise NotImplementedError, \ "Directory listing of URLs, not supported yet." Modified: branches/1.2.x/numpy/lib/arraysetops.py =================================================================== --- branches/1.2.x/numpy/lib/arraysetops.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/arraysetops.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -80,7 +80,7 @@ Parameters ---------- - ar1 : array-like + ar1 : array_like This array will be flattened if it is not already 1-D. return_index : bool, optional If True, also return the indices against `ar1` that result in the @@ -102,8 +102,8 @@ See Also -------- - numpy.lib.arraysetops : Module with a number of other functions - for performing set operations on arrays. + numpy.lib.arraysetops : Module with a number of other functions + for performing set operations on arrays. Examples -------- @@ -231,14 +231,14 @@ Parameters ---------- - ar1 : array + ar1 : array_like Input array. - ar2 : array + ar2 : array_like Input array. Returns ------- - xor : array + xor : ndarray The values that are only in one, but not both, of the input arrays. See Also @@ -270,15 +270,15 @@ Parameters ---------- - ar1 : array + ar1 : array_like Input array. - ar2 : array + ar2 : array_like Input array. Returns ------- - mask : bool-array - The values ar1[mask] are in ar2. + mask : ndarray, bool + The values `ar1[mask]` are in `ar2`. See Also -------- @@ -326,7 +326,7 @@ Returns ------- - union : array + union : ndarray Unique union of input arrays. See also @@ -346,14 +346,14 @@ Parameters ---------- - ar1 : array + ar1 : array_like Input array. - ar2 : array + ar2 : array_like Input comparison array. Returns ------- - difference : array + difference : ndarray The values in ar1 that are not in ar2. See Also Modified: branches/1.2.x/numpy/lib/financial.py =================================================================== --- branches/1.2.x/numpy/lib/financial.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/financial.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -30,26 +30,36 @@ Parameters ---------- - rate : array-like - Rate of interest (per period) - nper : array-like + rate : scalar or array_like of shape(M, ) + Rate of interest as decimal (not per cent) per period + nper : scalar or array_like of shape(M, ) Number of compounding periods - pmt : array-like + pmt : scalar or array_like of shape(M, ) Payment - pv : array-like + pv : scalar or array_like of shape(M, ) Present value - when : array-like - When payments are due ('begin' (1) or 'end' (0)) + when : {{'begin', 1}, {'end', 0}}, {string, int}, optional + When payments are due ('begin' (1) or 'end' (0)). + Defaults to {'end', 0}. + Returns + ------- + out : ndarray + Future values. If all input is scalar, returns a scalar float. If + any input is array_like, returns future values for each input element. + If multiple inputs are array_like, they all must have the same shape. + Notes ----- The future value is computed by solving the equation:: - fv + pv*(1+rate)**nper + pmt*(1+rate*when)/rate * ((1+rate)**nper - 1) == 0 + fv + + pv*(1+rate)**nper + + pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) == 0 or, when ``rate == 0``:: - fv + pv + pmt * nper == 0 + fv + pv + pmt * nper == 0 Examples -------- @@ -64,6 +74,13 @@ available today). Thus, saving $100 a month at 5% annual interest leads to $15,692.93 available to spend in 10 years. + If any input is array_like, returns an array of equal shape. Let's + compare different interest rates from the example above. + + >>> a = np.array((0.05, 0.06, 0.07))/12 + >>> np.fv(a, 10*12, -100, -100) + array([ 15692.92889434, 16569.87435405, 17509.44688102]) + """ when = _convert_when(when) rate, nper, pmt, pv, when = map(np.asarray, [rate, nper, pmt, pv, when]) @@ -75,26 +92,36 @@ def pmt(rate, nper, pv, fv=0, when='end'): """ - Compute the payment. + Compute the payment against loan principal plus interest. Parameters ---------- - rate : array-like + rate : array_like Rate of interest (per period) - nper : array-like + nper : array_like Number of compounding periods - pv : array-like + pv : array_like Present value - fv : array-like + fv : array_like Future value - when : array-like + when : {{'begin', 1}, {'end', 0}}, {string, int} When payments are due ('begin' (1) or 'end' (0)) + Returns + ------- + out : ndarray + Payment against loan plus interest. If all input is scalar, returns a + scalar float. If any input is array_like, returns payment for each + input element. If multiple inputs are array_like, they all must have + the same shape. + Notes ----- The payment ``pmt`` is computed by solving the equation:: - fv + pv*(1+rate)**nper + pmt*(1+rate*when)/rate * ((1+rate)**nper - 1) == 0 + fv + + pv*(1 + rate)**nper + + pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) == 0 or, when ``rate == 0``:: @@ -132,9 +159,9 @@ Payment pv : array_like Present value - fv : array_like + fv : array_like, optional Future value - when : array_like + when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0)) Notes @@ -157,8 +184,8 @@ So, over 64 months would be required to pay off the loan. - The same analysis could be done with several different interest rates and/or - payments and/or total amounts to produce an entire table. + The same analysis could be done with several different interest rates + and/or payments and/or total amounts to produce an entire table. >>> np.nper(*(np.ogrid[0.06/12:0.071/12:0.01/12, -200:-99:100, 6000:7001:1000])) array([[[ 32.58497782, 38.57048452], @@ -182,14 +209,73 @@ def ipmt(rate, per, nper, pv, fv=0.0, when='end'): """ - Not implemented. + Not implemented. Compute the payment portion for loan interest. + Parameters + ---------- + rate : scalar or array_like of shape(M, ) + Rate of interest as decimal (not per cent) per period + per : scalar or array_like of shape(M, ) + Interest paid against the loan changes during the life or the loan. + The `per` is the payment period to calculate the interest amount. + nper : scalar or array_like of shape(M, ) + Number of compounding periods + pv : scalar or array_like of shape(M, ) + Present value + fv : scalar or array_like of shape(M, ), optional + Future value + when : {{'begin', 1}, {'end', 0}}, {string, int}, optional + When payments are due ('begin' (1) or 'end' (0)). + Defaults to {'end', 0}. + + Returns + ------- + out : ndarray + Interest portion of payment. If all input is scalar, returns a scalar + float. If any input is array_like, returns interest payment for each + input element. If multiple inputs are array_like, they all must have + the same shape. + + See Also + -------- + ppmt, pmt, pv + + Notes + ----- + The total payment is made up of payment against principal plus interest. + + ``pmt = ppmt + ipmt`` + """ total = pmt(rate, nper, pv, fv, when) # Now, compute the nth step in the amortization raise NotImplementedError def ppmt(rate, per, nper, pv, fv=0.0, when='end'): + """ + Not implemented. Compute the payment against loan principal. + + Parameters + ---------- + rate : array_like + Rate of interest (per period) + per : array_like, int + Amount paid against the loan changes. The `per` is the period of + interest. + nper : array_like + Number of compounding periods + pv : array_like + Present value + fv : array_like, optional + Future value + when : {{'begin', 1}, {'end', 0}}, {string, int} + When payments are due ('begin' (1) or 'end' (0)) + + See Also + -------- + pmt, pv, ipmt + + """ total = pmt(rate, nper, pv, fv, when) return total - ipmt(rate, per, nper, pv, fv, when) @@ -199,22 +285,29 @@ Parameters ---------- - rate : array-like + rate : array_like Rate of interest (per period) - nper : array-like + nper : array_like Number of compounding periods - pmt : array-like + pmt : array_like Payment - fv : array-like + fv : array_like, optional Future value - when : array-like + when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0)) + Returns + ------- + out : ndarray, float + Present value of a series of payments or investments. + Notes ----- The present value ``pv`` is computed by solving the equation:: - fv + pv*(1+rate)**nper + pmt*(1+rate*when)/rate * ((1+rate)**nper - 1) = 0 + fv + + pv*(1 + rate)**nper + + pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) = 0 or, when ``rate = 0``:: @@ -258,7 +351,7 @@ Present value fv : array_like Future value - when : array_like, optional + when : {{'begin', 1}, {'end', 0}}, {string, int}, optional When payments are due ('begin' (1) or 'end' (0)) guess : float, optional Starting guess for solving the rate of interest @@ -296,11 +389,27 @@ return rn def irr(values): - """Internal Rate of Return + """ + Return the Internal Rate of Return (IRR). - This is the rate of return that gives a net present value of 0.0 + This is the rate of return that gives a net present value of 0.0. - npv(irr(values), values) == 0.0 + Parameters + ---------- + values : array_like, shape(N,) + Input cash flows per time period. At least the first value would be + negative to represent the investment in the project. + + Returns + ------- + out : float + Internal Rate of Return for periodic input values. + + Examples + -------- + >>> np.irr([-100, 39, 59, 55, 20]) + 0.2809484211599611 + """ res = np.roots(values[::-1]) # Find the root(s) between 0 and 1 @@ -314,25 +423,51 @@ return rate def npv(rate, values): - """Net Present Value + """ + Returns the NPV (Net Present Value) of a cash flow series. - sum ( values_k / (1+rate)**k, k = 1..n) + Parameters + ---------- + rate : scalar + The discount rate. + values : array_like, shape(M, ) + The values of the time series of cash flows. Must be the same + increment as the `rate`. + + Returns + ------- + out : float + The NPV of the input cash flow series `values` at the discount `rate`. + + Notes + ----- + Returns the result of: + + .. math :: \\sum_{t=1}^M{\\frac{values_t}{(1+rate)^{t}}} + """ values = np.asarray(values) return (values / (1+rate)**np.arange(1,len(values)+1)).sum(axis=0) def mirr(values, finance_rate, reinvest_rate): - """Modified internal rate of return + """ + Modified internal rate of return. Parameters ---------- - values: + values : array_like Cash flows (must contain at least one positive and one negative value) or nan is returned. - finance_rate : + finance_rate : scalar Interest rate paid on the cash flows - reinvest_rate : + reinvest_rate : scalar Interest rate received on the cash flows upon reinvestment + + Returns + ------- + out : float + Modified internal rate of return + """ values = np.asarray(values) Modified: branches/1.2.x/numpy/lib/function_base.py =================================================================== --- branches/1.2.x/numpy/lib/function_base.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/function_base.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -34,34 +34,35 @@ def linspace(start, stop, num=50, endpoint=True, retstep=False): """ - Return evenly spaced numbers. + Return evenly spaced numbers over a specified interval. - `linspace` returns `num` evenly spaced samples, calculated over the - interval ``[start, stop]``. The endpoint of the interval can optionally - be excluded. + Returns `num` evenly spaced samples, calculated over the + interval [`start`, `stop` ]. + The endpoint of the interval can optionally be excluded. + Parameters ---------- - start : float + start : {float, int} The starting value of the sequence. - stop : float + stop : {float, int} The end value of the sequence, unless `endpoint` is set to False. In that case, the sequence consists of all but the last of ``num + 1`` evenly spaced samples, so that `stop` is excluded. Note that the step size changes when `endpoint` is False. - num : int + num : int, optional Number of samples to generate. Default is 50. - endpoint : bool - If true, `stop` is the last sample. Otherwise, it is not included. + endpoint : bool, optional + If True, `stop` is the last sample. Otherwise, it is not included. Default is True. - retstep : bool + retstep : bool, optional If True, return (`samples`, `step`), where `step` is the spacing between samples. Returns ------- samples : ndarray - `num` equally spaced samples in the closed interval + There are `num` equally spaced samples in the closed interval ``[start, stop]`` or the half-open interval ``[start, stop)`` (depending on whether `endpoint` is True or False). step : float (only if `retstep` is True) @@ -71,8 +72,7 @@ See Also -------- arange : Similiar to `linspace`, but uses a step size (instead of the - number of samples). Note that, when used with a float - endpoint, the endpoint may or may not be included. + number of samples). logspace : Samples uniformly distributed in log space. Examples @@ -409,36 +409,36 @@ Parameters ---------- - sample : array-like - Data to histogram passed as a sequence of D arrays of length N, or - as an (N,D) array. + sample : array_like + Data to histogram passed as a sequence of D arrays of length N, or + as an (N,D) array. bins : sequence or int, optional - The bin specification: + The bin specification: - * A sequence of arrays describing the bin edges along each dimension. - * The number of bins for each dimension (nx, ny, ... =bins) - * The number of bins for all dimensions (nx=ny=...=bins). + * A sequence of arrays describing the bin edges along each dimension. + * The number of bins for each dimension (nx, ny, ... =bins) + * The number of bins for all dimensions (nx=ny=...=bins). range : sequence, optional - A sequence of lower and upper bin edges to be used if the edges are - not given explicitely in `bins`. Defaults to the minimum and maximum - values along each dimension. + A sequence of lower and upper bin edges to be used if the edges are + not given explicitely in `bins`. Defaults to the minimum and maximum + values along each dimension. normed : boolean, optional - If False, returns the number of samples in each bin. If True, returns - the bin density, ie, the bin count divided by the bin hypervolume. - weights : array-like (N,), optional - An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. - Weights are normalized to 1 if normed is True. If normed is False, the - values of the returned histogram are equal to the sum of the weights - belonging to the samples falling into each bin. + If False, returns the number of samples in each bin. If True, returns + the bin density, ie, the bin count divided by the bin hypervolume. + weights : array_like (N,), optional + An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. + Weights are normalized to 1 if normed is True. If normed is False, the + values of the returned histogram are equal to the sum of the weights + belonging to the samples falling into each bin. Returns ------- - H : array - The multidimensional histogram of sample x. See normed and weights for - the different possible semantics. + H : ndarray + The multidimensional histogram of sample x. See normed and weights for + the different possible semantics. edges : list - A list of D arrays describing the bin edges for each dimension. + A list of D arrays describing the bin edges for each dimension. See Also -------- @@ -572,25 +572,24 @@ """ Return the weighted average of array over the specified axis. - Parameters ---------- a : array_like Data to be averaged. - axis : {None, integer}, optional + axis : int, optional Axis along which to average `a`. If `None`, averaging is done over the entire array irrespective of its shape. - weights : {None, array_like}, optional + weights : array_like, optional The importance that each datum has in the computation of the average. - The weights array can either be 1D (in which case its length must be + The weights array can either be 1-D (in which case its length must be the size of `a` along the given axis) or of the same shape as `a`. If `weights=None`, then all data in `a` are assumed to have a weight equal to one. - returned : {False, boolean}, optional - If `True`, the tuple (`average`, `sum_of_weights`) is returned, - otherwise only the average is returned. Note that if `weights=None`, - `sum_of_weights` is equivalent to the number of elements over which - the average is taken. + returned : bool, optional + Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`) + is returned, otherwise only the average is returned. Note that + if `weights=None`, `sum_of_weights` is equivalent to the number of + elements over which the average is taken. Returns ------- @@ -660,8 +659,65 @@ return avg def asarray_chkfinite(a): - """Like asarray, but check that no NaNs or Infs are present. """ + Convert the input to an array, checking for NaNs or Infs. + + Parameters + ---------- + a : array_like + Input data, in any form that can be converted to an array. This + includes lists, lists of tuples, tuples, tuples of tuples, tuples + of lists and ndarrays. Success requires no NaNs or Infs. + dtype : data-type, optional + By default, the data-type is inferred from the input data. + order : {'C', 'F'}, optional + Whether to use row-major ('C') or column-major ('FORTRAN') memory + representation. Defaults to 'C'. + + Returns + ------- + out : ndarray + Array interpretation of `a`. No copy is performed if the input + is already an ndarray. If `a` is a subclass of ndarray, a base + class ndarray is returned. + + Raises + ------ + ValueError + Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity). + + See Also + -------- + asarray : Create and array. + asanyarray : Similar function which passes through subclasses. + ascontiguousarray : Convert input to a contiguous array. + asfarray : Convert input to a floating point ndarray. + asfortranarray : Convert input to an ndarray with column-major + memory order. + fromiter : Create an array from an iterator. + fromfunction : Construct an array by executing a function on grid + positions. + + Examples + -------- + Convert a list into an array. If all elements are finite + ``asarray_chkfinite`` is identical to ``asarray``. + + >>> a = [1, 2] + >>> np.asarray_chkfinite(a) + array([1, 2]) + + Raises ValueError if array_like contains Nans or Infs. + + >>> a = [1, 2, np.inf] + >>> try: + ... np.asarray_chkfinite(a) + ... except ValueError: + ... print 'ValueError' + ... + ValueError + + """ a = asarray(a) if (a.dtype.char in typecodes['AllFloat']) \ and (_nx.isnan(a).any() or _nx.isinf(a).any()): @@ -821,6 +877,15 @@ output += [V[m] for V,C in zip(values,cond) if C[m]] or [default] + Examples + -------- + >>> t = np.arange(10) + >>> s = np.arange(10)*100 + >>> condlist = [t == 4, t > 5] + >>> choicelist = [s, t] + >>> np.select(condlist, choicelist) + array([ 0, 0, 0, 0, 400, 0, 6, 7, 8, 9]) + """ n = len(condlist) n2 = len(choicelist) @@ -1155,14 +1220,18 @@ z : array_like A complex number or sequence of complex numbers. deg : bool, optional - Return angle in degrees if True, radians if False. Default is False. + Return angle in degrees if True, radians if False (default). Returns ------- angle : {ndarray, scalar} - The angle is defined as counterclockwise from the positive real axis on + The counterclockwise angle from the positive real axis on the complex plane, with dtype as numpy.float64. + See Also + -------- + arctan2 + Examples -------- >>> np.angle([1.0, 1.0j, 1+1j]) # in radians @@ -1233,6 +1302,13 @@ out : complex ndarray Always returns a sorted complex array. + Examples + -------- + >>> np.sort_complex([5, 3, 6, 2, 1]) + array([ 1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j]) + >>> np.sort_complex([5 + 2j, 3 - 1j, 6 - 2j, 2 - 3j, 1 - 5j]) + array([ 1.-5.j, 2.-3.j, 3.-1.j, 5.+2.j, 6.-2.j]) + """ b = array(a,copy=True) b.sort() @@ -1360,10 +1436,28 @@ return _nx.take(ravel(arr), nonzero(ravel(condition))[0]) def place(arr, mask, vals): - """Similar to putmask arr[mask] = vals but the 1D array vals has the - same number of elements as the non-zero values of mask. Inverse of - extract. + """ + Changes elements of an array based on conditional and input values. + Similar to ``putmask(a, mask, vals)`` but the 1D array `vals` has the + same number of elements as the non-zero values of `mask`. Inverse of + ``extract``. + + Sets `a`.flat[n] = `values`\\[n] for each n where `mask`.flat[n] is true. + + Parameters + ---------- + a : array_like + Array to put data into. + mask : array_like + Boolean mask array. + values : array_like, shape(number of non-zero `mask`, ) + Values to put into `a`. + + See Also + -------- + putmask, put, take + """ return _insert(arr, mask, vals) @@ -1401,47 +1495,112 @@ def nansum(a, axis=None): """ - Sum the array along the given axis, treating NaNs as zero. + Return the sum of array elements over a given axis treating + Not a Numbers (NaNs) as zero. Parameters ---------- - a : array-like - Input array. - axis : {int, None}, optional - Axis along which the sum is computed. By default `a` is flattened. + a : array_like + Array containing numbers whose sum is desired. If `a` is not an + array, a conversion is attempted. + axis : int, optional + Axis along which the sum is computed. The default is to compute + the sum of the flattened array. Returns ------- - y : {ndarray, scalar} - The sum ignoring NaNs. + y : ndarray + An array with the same shape as a, with the specified axis removed. + If a is a 0-d array, or if axis is None, a scalar is returned with + the same dtype as `a`. + See Also + -------- + numpy.sum : Sum across array including Not a Numbers. + isnan : Shows which elements are Not a Number (NaN). + isfinite: Shows which elements are not: Not a Number, positive and + negative infinity + + Notes + ----- + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + If positive or negative infinity are present the result is positive or + negative infinity. But if both positive and negative infinity are present, + the result is Not A Number (NaN). + + Arithmetic is modular when using integer types (all elements of `a` must + be finite i.e. no elements that are NaNs, positive infinity and negative + infinity because NaNs are floating point types), and no error is raised + on overflow. + + Examples -------- - >>> np.nansum([np.nan, 1]) + >>> np.nansum(1) + 1 + >>> np.nansum([1]) + 1 + >>> np.nansum([1, np.nan]) 1.0 >>> a = np.array([[1, 1], [1, np.nan]]) + >>> np.nansum(a) + 3.0 >>> np.nansum(a, axis=0) array([ 2., 1.]) + When positive infinity and negative infinity are present + + >>> np.nansum([1, np.nan, np.inf]) + inf + >>> np.nansum([1, np.nan, np.NINF]) + -inf + >>> np.nansum([1, np.nan, np.inf, np.NINF]) + nan + """ return _nanop(np.sum, 0, a, axis) def nanmin(a, axis=None): """ - Find the minimum along the given axis, ignoring NaNs. + Return the minimum of array elements over the given axis ignoring any NaNs. Parameters ---------- a : array_like - Input array. + Array containing numbers whose sum is desired. If `a` is not + an array, a conversion is attempted. axis : int, optional - Axis along which the minimum is computed. By default `a` is flattened. + Axis along which the minimum is computed.The default is to compute + the minimum of the flattened array. Returns ------- y : {ndarray, scalar} - The minimum ignoring NaNs. + An array with the same shape as `a`, with the specified axis removed. + If `a` is a 0-d array, or if axis is None, a scalar is returned. The + the same dtype as `a` is returned. + + See Also + -------- + numpy.amin : Minimum across array including any Not a Numbers. + numpy.nanmax : Maximum across array ignoring any Not a Numbers. + isnan : Shows which elements are Not a Number (NaN). + isfinite: Shows which elements are not: Not a Number, positive and + negative infinity + + Notes + ----- + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Positive infinity is treated as a very large number and negative infinity + is treated as a very small (i.e. negative) number. + + If the input has a integer type, an integer type is returned unless + the input contains NaNs and infinity. + + Examples -------- >>> a = np.array([[1, 2], [3, np.nan]]) @@ -1452,35 +1611,66 @@ >>> np.nanmin(a, axis=1) array([ 1., 3.]) + When positive infinity and negative infinity are present: + + >>> np.nanmin([1, 2, np.nan, np.inf]) + 1.0 + >>> np.nanmin([1, 2, np.nan, np.NINF]) + -inf + """ return _nanop(np.min, np.inf, a, axis) def nanargmin(a, axis=None): """ - Return indices of the minimum values along the given axis of `a`, - ignoring NaNs. + Return indices of the minimum values along an axis, ignoring NaNs. - Refer to `numpy.nanargmax` for detailed documentation. + See Also + -------- + nanargmax : corresponding function for maxima; see for details. + """ return _nanop(np.argmin, np.inf, a, axis) def nanmax(a, axis=None): """ - Find the maximum along the given axis, ignoring NaNs. + Return the maximum of array elements over the given axis ignoring any NaNs. Parameters ---------- - a : array-like - Input array. - axis : {int, None}, optional - Axis along which the maximum is computed. By default `a` is flattened. + a : array_like + Array containing numbers whose maximum is desired. If `a` is not + an array, a conversion is attempted. + axis : int, optional + Axis along which the maximum is computed.The default is to compute + the maximum of the flattened array. Returns ------- - y : {ndarray, scalar} - The maximum ignoring NaNs. + y : ndarray + An array with the same shape as `a`, with the specified axis removed. + If `a` is a 0-d array, or if axis is None, a scalar is returned. The + the same dtype as `a` is returned. + See Also + -------- + numpy.amax : Maximum across array including any Not a Numbers. + numpy.nanmin : Minimum across array ignoring any Not a Numbers. + isnan : Shows which elements are Not a Number (NaN). + isfinite: Shows which elements are not: Not a Number, positive and + negative infinity + + Notes + ----- + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Positive infinity is treated as a very large number and negative infinity + is treated as a very small (i.e. negative) number. + + If the input has a integer type, an integer type is returned unless + the input contains NaNs and infinity. + Examples -------- >>> a = np.array([[1, 2], [3, np.nan]]) @@ -1491,29 +1681,35 @@ >>> np.nanmax(a, axis=1) array([ 2., 3.]) + When positive infinity and negative infinity are present: + + >>> np.nanmax([1, 2, np.nan, np.NINF]) + 2.0 + >>> np.nanmax([1, 2, np.nan, np.inf]) + inf + """ return _nanop(np.max, -np.inf, a, axis) def nanargmax(a, axis=None): """ - Return indices of the maximum values over the given axis of 'a', - ignoring NaNs. + Return indices of the maximum values over an axis, ignoring NaNs. Parameters ---------- - a : array-like + a : array_like Input data. axis : int, optional Axis along which to operate. By default flattened input is used. Returns ------- - index_array : {ndarray, int} + index_array : ndarray An array of indices or a single index value. See Also -------- - argmax + argmax, nanargmin Examples -------- @@ -1531,9 +1727,20 @@ return _nanop(np.argmax, -np.inf, a, axis) def disp(mesg, device=None, linefeed=True): - """Display a message to the given device (default is sys.stdout) - with or without a linefeed. """ + Display a message on a device + + Parameters + ---------- + mesg : string + Message to display. + device : device object with 'write' method + Device to write message. If None, defaults to ``sys.stdout`` which is + very similar to ``print``. + linefeed : bool, optional + Option whether to print a line feed or not. Defaults to True. + + """ if device is None: import sys device = sys.stdout @@ -1695,11 +1902,11 @@ Parameters ---------- - m : array-like - A 1D or 2D array containing multiple variables and observations. + m : array_like + A 1-D or 2-D array containing multiple variables and observations. Each row of `m` represents a variable, and each column a single observation of all those variables. Also see `rowvar` below. - y : array-like, optional + y : array_like, optional An additional set of variables and observations. `y` has the same form as that of `m`. rowvar : int, optional @@ -1790,7 +1997,7 @@ def corrcoef(x, y=None, rowvar=1, bias=0): """ - Correlation coefficients. + Return correlation coefficients. Please refer to the documentation for `cov` for more detail. The relationship between the correlation coefficient matrix, P, and the @@ -2014,9 +2221,9 @@ Returns ------- - out : array + out : ndarray, shape(M,) The window, normalized to one (the value one - appears only if the number of samples is odd). + appears only if `M` is odd). See Also -------- @@ -2259,18 +2466,31 @@ def i0(x): """ - Modified Bessel function of the first kind, order 0, :math:`I_0` + Modified Bessel function of the first kind, order 0. + Usually denoted :math:`I_0`. + Parameters ---------- - x : array-like, dtype float or complex + x : array_like, dtype float or complex Argument of the Bessel function. Returns ------- out : ndarray, shape z.shape, dtype z.dtype - The modified Bessel function evaluated for all elements of `x`. + The modified Bessel function evaluated at the elements of `x`. + See Also + -------- + scipy.special.iv, scipy.special.ive + + References + ---------- + .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", + 10th printing, 1964, pp. 374. http://www.math.sfu.ca/~cbm/aands/ + .. [2] Wikipedia, "Bessel function", + http://en.wikipedia.org/wiki/Bessel_function + Examples -------- >>> np.i0([0.]) @@ -2361,11 +2581,11 @@ References ---------- - .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by - digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. - John Wiley and Sons, New York, (1966). - .. [2]\tE.R. Kanasewich, "Time Sequence Analysis in Geophysics", The - University of Alberta Press, 1975, pp. 177-178. + .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by + digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285. + John Wiley and Sons, New York, (1966). + .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The + University of Alberta Press, 1975, pp. 177-178. .. [3] Wikipedia, "Window function", http://en.wikipedia.org/wiki/Window_function @@ -2483,6 +2703,28 @@ return sin(y)/y def msort(a): + """ + Return a copy of an array sorted along the first axis. + + Parameters + ---------- + a : array_like + Array to be sorted. + + Returns + ------- + sorted_array : ndarray + Array of the same type and shape as `a`. + + See Also + -------- + sort + + Notes + ----- + ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``. + + """ b = array(a,subok=True,copy=True) b.sort(0) return b @@ -2593,7 +2835,7 @@ ---------- y : array_like Input array to integrate. - x : {array_like, None}, optional + x : array_like, optional If `x` is None, then spacing between all `y` elements is 1. dx : scalar, optional If `x` is None, spacing given by `dx` is assumed. @@ -2707,11 +2949,11 @@ Parameters ---------- - arr : array-like + arr : array_like Input array. obj : slice, integer or an array of integers Indicate which sub-arrays to remove. - axis : integer or None + axis : integer, optional The axis along which to delete the subarray defined by `obj`. If `axis` is None, `obj` is applied to the flattened array. Modified: branches/1.2.x/numpy/lib/getlimits.py =================================================================== --- branches/1.2.x/numpy/lib/getlimits.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/getlimits.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -22,6 +22,8 @@ class finfo(object): """ + finfo(dtype) + Machine limits for floating point types. Attributes @@ -170,6 +172,8 @@ class iinfo: """ + iinfo(type) + Machine limits for integer types. Attributes Modified: branches/1.2.x/numpy/lib/index_tricks.py =================================================================== --- branches/1.2.x/numpy/lib/index_tricks.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/index_tricks.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -20,8 +20,6 @@ """ Convert a flat index into an index tuple for an array of given shape. - e.g. for a 2x2 array, unravel_index(2,(2,2)) returns (1,0). - Parameters ---------- x : int @@ -31,25 +29,26 @@ Notes ----- - Since x.flat[p] == x.max() it may be easier to use flattened indexing - than to re-map the index to a tuple. + In the Examples section, since ``arr.flat[x] == arr.max()`` it may be + easier to use flattened indexing than to re-map the index to a tuple. Examples -------- - >>> x = np.ones((5,4)) - >>> x + >>> arr = np.ones((5,4)) + >>> arr array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11], [12, 13, 14, 15], [16, 17, 18, 19]]) - >>> p = x.argmax() - >>> p + >>> x = arr.argmax() + >>> x 19 - >>> idx = np.unravel_index(p, x.shape) + >>> dims = arr.shape + >>> idx = np.unravel_index(x, dims) >>> idx (4, 3) - >>> x[idx] == x.max() + >>> arr[idx] == arr.max() True """ Modified: branches/1.2.x/numpy/lib/io.py =================================================================== --- branches/1.2.x/numpy/lib/io.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/io.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -81,36 +81,36 @@ def load(file, memmap=False): """ - Load pickled, ``.npy``, and ``.npz`` binary files. + Load a pickled, ``.npy``, or ``.npz`` binary file. Parameters ---------- file : file-like object or string - The file to read. It must support seek and read methods. + The file to read. It must support ``seek()`` and ``read()`` methods. memmap : bool If True, then memory-map the ``.npy`` file (or unzip the ``.npz`` file - into a temporary directory and memory-map each component). This has no - effect for a pickled file. + into a temporary directory and memory-map each component). This has + no effect for a pickled file. Returns ------- result : array, tuple, dict, etc. Data stored in the file. - - If file contains pickle data, then whatever is stored in the - pickle is returned. - - - If the file is a ``.npy`` file, then an array is returned. - - - If the file is a ``.npz`` file, then a dictionary-like object is - returned, containing {filename: array} key-value pairs, one for - every file in the archive. - Raises ------ IOError If the input file does not exist or cannot be read. + Notes + ----- + - If file contains pickle data, then whatever is stored in the + pickle is returned. + - If the file is a ``.npy`` file, then an array is returned. + - If the file is a ``.npz`` file, then a dictionary-like object is + returned, containing {filename: array} key-value pairs, one for + every file in the archive. + Examples -------- >>> np.save('/tmp/123', np.array([1, 2, 3]) @@ -178,12 +178,23 @@ format.write_array(fid, arr) def savez(file, *args, **kwds): - """Save several arrays into an .npz file format which is a zipped-archive + """ + Save several arrays into an .npz file format which is a zipped-archive of arrays If keyword arguments are given, then filenames are taken from the keywords. If arguments are passed in with no keywords, then stored file names are arr_0, arr_1, etc. + + Parameters + ---------- + file : string + File name of .npz file. + args : Arguments + Function arguments. + kwds : Keyword arguments + Keywords. + """ # Import is postponed to here since zipfile depends on gzip, an optional Modified: branches/1.2.x/numpy/lib/polynomial.py =================================================================== --- branches/1.2.x/numpy/lib/polynomial.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/polynomial.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -129,7 +129,7 @@ Parameters ---------- - p : (N,) array_like + p : array_like of shape(M,) Rank-1 array of polynomial co-efficients. Returns @@ -200,7 +200,7 @@ Parameters ---------- - p : poly1d or sequence + p : {array_like, poly1d} Polynomial to differentiate. A sequence is interpreted as polynomial coefficients, see `poly1d`. m : int, optional @@ -523,7 +523,7 @@ def polyval(p, x): """ - Evaluate the polynomial p at x. + Evaluate a polynomial at specific values. If p is of length N, this function returns the value: @@ -543,7 +543,7 @@ Returns ------- - values : {array, poly1d} + values : {ndarray, poly1d} If either p or x is an instance of poly1d, then an instance of poly1d is returned, otherwise a 1D array is returned. In the case where x is a poly1d, the result is the composition of the two polynomials, i.e., @@ -577,8 +577,29 @@ return y def polyadd(a1, a2): - """Adds two polynomials represented as sequences """ + Returns sum of two polynomials. + + Returns sum of polynomials; `a1` + `a2`. Input polynomials are + represented as an array_like sequence of terms or a poly1d object. + + Parameters + ---------- + a1 : {array_like, poly1d} + Polynomial as sequence of terms. + a2 : {array_like, poly1d} + Polynomial as sequence of terms. + + Returns + ------- + out : {ndarray, poly1d} + Array representing the polynomial terms. + + See Also + -------- + polyval, polydiv, polymul, polyadd + + """ truepoly = (isinstance(a1, poly1d) or isinstance(a2, poly1d)) a1 = atleast_1d(a1) a2 = atleast_1d(a2) @@ -596,8 +617,36 @@ return val def polysub(a1, a2): - """Subtracts two polynomials represented as sequences """ + Returns difference from subtraction of two polynomials input as sequences. + + Returns difference of polynomials; `a1` - `a2`. Input polynomials are + represented as an array_like sequence of terms or a poly1d object. + + Parameters + ---------- + a1 : {array_like, poly1d} + Minuend polynomial as sequence of terms. + a2 : {array_like, poly1d} + Subtrahend polynomial as sequence of terms. + + Returns + ------- + out : {ndarray, poly1d} + Array representing the polynomial terms. + + See Also + -------- + polyval, polydiv, polymul, polyadd + + Examples + -------- + .. math:: (2 x^2 + 10x - 2) - (3 x^2 + 10x -4) = (-x^2 + 2) + + >>> np.polysub([2, 10, -2], [3, 10, -4]) + array([-1, 0, 2]) + + """ truepoly = (isinstance(a1, poly1d) or isinstance(a2, poly1d)) a1 = atleast_1d(a1) a2 = atleast_1d(a2) @@ -616,8 +665,30 @@ def polymul(a1, a2): - """Multiplies two polynomials represented as sequences. """ + Returns product of two polynomials represented as sequences. + + The input arrays specify the polynomial terms in turn with a length equal + to the polynomial degree plus 1. + + Parameters + ---------- + a1 : {array_like, poly1d} + First multiplier polynomial. + a2 : {array_like, poly1d} + Second multiplier polynomial. + + Returns + ------- + out : {ndarray, poly1d} + Product of inputs. + + See Also + -------- + poly, polyadd, polyder, polydiv, polyfit, polyint, polysub, + polyval + + """ truepoly = (isinstance(a1, poly1d) or isinstance(a2, poly1d)) a1,a2 = poly1d(a1),poly1d(a2) val = NX.convolve(a1, a2) @@ -626,9 +697,41 @@ return val def polydiv(u, v): - """Computes q and r polynomials so that u(s) = q(s)*v(s) + r(s) - and deg r < deg v. """ + Returns the quotient and remainder of polynomial division. + + The input arrays specify the polynomial terms in turn with a length equal + to the polynomial degree plus 1. + + Parameters + ---------- + u : {array_like, poly1d} + Dividend polynomial. + v : {array_like, poly1d} + Divisor polynomial. + + Returns + ------- + q : ndarray + Polynomial terms of quotient. + r : ndarray + Remainder of polynomial division. + + See Also + -------- + poly, polyadd, polyder, polydiv, polyfit, polyint, polymul, polysub, + polyval + + Examples + -------- + .. math:: \\frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25 + + >>> x = np.array([3.0, 5.0, 2.0]) + >>> y = np.array([2.0, 1.0]) + >>> np.polydiv(x, y) + >>> (array([ 1.5 , 1.75]), array([ 0.25])) + + """ truepoly = (isinstance(u, poly1d) or isinstance(u, poly1d)) u = atleast_1d(u) v = atleast_1d(v) @@ -683,7 +786,7 @@ Parameters ---------- c_or_r : array_like - Polynomial coefficients, in decreasing powers. E.g., + Polynomial coefficients, in decreasing powers. For example, ``(1, 2, 3)`` implies :math:`x^2 + 2x + 3`. If `r` is set to True, these coefficients specify the polynomial roots (values where the polynomial evaluate to 0) instead. Modified: branches/1.2.x/numpy/lib/shape_base.py =================================================================== --- branches/1.2.x/numpy/lib/shape_base.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/shape_base.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -12,28 +12,28 @@ """ Apply function to 1-D slices along the given axis. - Execute `func1d(arr[i],*args)` where `func1d` takes 1-D arrays, `arr` is + Execute `func1d(a[i],*args)` where `func1d` takes 1-D arrays, `a` is the input array, and `i` is an integer that varies in order to apply the - function along the given axis for each 1-D subarray in `arr`. + function along the given axis for each 1-D subarray in `a`. Parameters ---------- func1d : function This function should be able to take 1-D arrays. It is applied to 1-D - slices of `arr` along the specified axis. + slices of `a` along the specified axis. axis : integer Axis along which `func1d` is applied. - arr : ndarray + a : ndarray Input array. args : any Additional arguments to `func1d`. Returns ------- - outarr : ndarray - The output array. The shape of `outarr` depends on the return - value of `func1d`. If it returns arrays with the same shape as the - input arrays it receives, `outarr` has the same shape as `arr`. + out : ndarray + The output array. The shape of `out` is identical to the shape of `a`, + except along the `axis` dimension, whose length is equal to the size + of the return value of `func1d`. See Also -------- @@ -112,28 +112,28 @@ """ Apply a function repeatedly over multiple axes. - `func` is called as `res = func(a, axis)`, with `axis` the first element - of `axes`. The result `res` of the function call has to have - the same or one less dimension(s) as `a`. If `res` has one less dimension - than `a`, a dimension is then inserted before `axis`. + `func` is called as `res = func(a, axis)`, where `axis` is the first + element of `axes`. The result `res` of the function call must have + either the same dimensions as `a` or one less dimension. If `res` has one + less dimension than `a`, a dimension is inserted before `axis`. The call to `func` is then repeated for each axis in `axes`, with `res` as the first argument. Parameters ---------- func : function - This function should take two arguments, `func(a, axis)`. - arr : ndarray + This function must take two arguments, `func(a, axis)`. + a : ndarray Input array. axes : array_like - Axes over which `func` has to be applied, the elements should be + Axes over which `func` is applied, the elements must be integers. Returns ------- val : ndarray - The output array. The number of dimensions is the same as `a`, - the shape can be different, this depends on whether `func` changes + The output array. The number of dimensions is the same as `a`, but + the shape can be different. This depends on whether `func` changes the shape of its output with respect to its input. See Also @@ -448,7 +448,7 @@ Stack arrays in sequence horizontally (column wise) Take a sequence of arrays and stack them horizontally to make - a single array. hstack will rebuild arrays divided by hsplit. + a single array. Rebuild arrays divided by ``hsplit``. Parameters ---------- @@ -458,8 +458,19 @@ Returns ------- stacked : ndarray - Ndarray formed by stacking the given arrays. + The array formed by stacking the given arrays. + See Also + -------- + vstack : Stack along first axis. + dstack : Stack along third axis. + concatenate : Join arrays. + hsplit : Split array along second axis. + + Notes + ----- + Equivalent to ``np.concatenate(tup, axis=1)`` + Examples -------- >>> a = np.array((1,2,3)) @@ -512,11 +523,12 @@ def dstack(tup): """ - Stack arrays in sequence depth wise (along third dimension) + Stack arrays in sequence depth wise (along third axis) - Take a sequence of arrays and stack them along the third axis. + Takes a sequence of arrays and stack them along the third axis + to make a single array. Rebuilds arrays divided by ``dsplit``. This is a simple way to stack 2D arrays (images) into a single - 3D array for processing. dstack will rebuild arrays divided by dsplit. + 3D array for processing. Parameters ---------- @@ -524,6 +536,22 @@ Arrays to stack. All of them must have the same shape along all but the third axis. + Returns + ------- + stacked : ndarray + The array formed by stacking the given arrays. + + See Also + -------- + vstack : Stack along first axis. + hstack : Stack along second axis. + concatenate : Join arrays. + dsplit : Split array along third axis. + + Notes + ----- + Equivalent to ``np.concatenate(tup, axis=2)`` + Examples -------- >>> a = np.array((1,2,3)) Modified: branches/1.2.x/numpy/lib/twodim_base.py =================================================================== --- branches/1.2.x/numpy/lib/twodim_base.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/twodim_base.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -308,13 +308,13 @@ Number of rows in the array. M : int, optional Number of columns in the array. - By default, `M` is taken to equal to `N`. + By default, `M` is taken equal to `N`. k : int, optional The sub-diagonal below which the array is filled. - ``k = 0`` is the main diagonal, while ``k < 0`` is below it, - and ``k > 0`` is above. The default is 0. + `k` = 0 is the main diagonal, while `k` < 0 is below it, + and `k` > 0 is above. The default is 0. dtype : dtype, optional - Data type of the returned array. The default is `float`. + Data type of the returned array. The default is float. Returns ------- @@ -341,13 +341,13 @@ def tril(m, k=0): """ - Lower triangular. + Lower triangle of an array. - Return a copy of an array with elements above the k-th diagonal zeroed. + Return a copy of an array with elements above the `k`-th diagonal zeroed. Parameters ---------- - m : array-like, shape (M, N) + m : array_like, shape (M, N) Input array. k : int Diagonal above which to zero elements. @@ -377,7 +377,7 @@ def triu(m, k=0): """ - Upper triangular. + Upper triangle of an array. Construct a copy of a matrix with elements below the k-th diagonal zeroed. @@ -453,9 +453,9 @@ Parameters ---------- - x : array-like (N,) + x : array_like, shape(N,) A sequence of values to be histogrammed along the first dimension. - y : array-like (N,) + y : array_like, shape(M,) A sequence of values to be histogrammed along the second dimension. bins : int or [int, int] or array-like or [array, array], optional The bin specification: @@ -465,7 +465,7 @@ * the bin edges for the two dimensions (x_edges=y_edges=bins), * the bin edges in each dimension (x_edges, y_edges = bins). - range : array-like, (2,2), optional + range : array_like, shape(2,2), optional The leftmost and rightmost edges of the bins along each dimension (if not specified explicitly in the `bins` parameters): [[xmin, xmax], [ymin, ymax]]. All values outside of this range will be @@ -473,7 +473,7 @@ normed : boolean, optional If False, returns the number of samples in each bin. If True, returns the bin density, ie, the bin count divided by the bin area. - weights : array-like (N,), optional + weights : array-like, shape(N,), optional An array of values `w_i` weighing each sample `(x_i, y_i)`. Weights are normalized to 1 if normed is True. If normed is False, the values of the returned histogram are equal to the sum of the weights belonging to the @@ -481,13 +481,13 @@ Returns ------- - H : array (nx, ny) + H : ndarray, shape(nx, ny) The bidimensional histogram of samples x and y. Values in x are histogrammed along the first dimension and values in y are histogrammed along the second dimension. - xedges : array (nx,) + xedges : ndarray, shape(nx,) The bin edges along the first dimension. - yedges : array (ny,) + yedges : ndarray, shape(ny,) The bin edges along the second dimension. See Also Modified: branches/1.2.x/numpy/lib/type_check.py =================================================================== --- branches/1.2.x/numpy/lib/type_check.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/type_check.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -42,7 +42,32 @@ return l[0][1] def asfarray(a, dtype=_nx.float_): - """asfarray(a,dtype=None) returns a as a float array.""" + """ + Return an array converted to float type. + + Parameters + ---------- + a : array_like + Input array. + dtype : string or dtype object, optional + Float type code to coerce input array `a`. If one of the 'int' dtype, + it is replaced with float64. + + Returns + ------- + out : ndarray, float + Input `a` as a float ndarray. + + Examples + -------- + >>> np.asfarray([2, 3]) + array([ 2., 3.]) + >>> np.asfarray([2, 3], dtype='float') + array([ 2., 3.]) + >>> np.asfarray([2, 3], dtype='int8') + array([ 2., 3.]) + + """ dtype = _nx.obj2sctype(dtype) if not issubclass(dtype, _nx.inexact): dtype = _nx.float_ @@ -54,7 +79,7 @@ Parameters ---------- - val : {array_like, scalar} + val : array_like Input array. Returns @@ -100,10 +125,27 @@ return asanyarray(val).imag def iscomplex(x): - """Return a boolean array where elements are True if that element - is complex (has non-zero imaginary part). + """ + Return a bool array, True if element is complex (non-zero imaginary part). For scalars, return a boolean. + + Parameters + ---------- + x : array_like + Input array. + + Returns + ------- + out : ndarray, bool + Output array. + + Examples + -------- + >>> x = np.array([1,2,3.j]) + >>> np.iscomplex(x) + array([False, False, True], dtype=bool) + """ ax = asanyarray(x) if issubclass(ax.dtype.type, _nx.complexfloating): @@ -219,7 +261,7 @@ Parameters ---------- - a : {array_like, scalar} + a : array_like Input array. tol : scalar Tolerance for the complex part of the elements in the array. @@ -241,6 +283,16 @@ 2.2204460492503131e-16. You can use 'np.finfo(np.float).eps' to print out the machine epsilon for floats. + Examples + -------- + >>> np.finfo(np.float).eps # DOCTEST +skip + 2.2204460492503131e-16 + + >>> np.real_if_close([2.1 + 4e-14j], tol = 1000) + array([ 2.1]) + >>> np.real_if_close([2.1 + 4e-13j], tol = 1000) + array([ 2.1 +4.00000000e-13j]) + """ a = asanyarray(a) if not issubclass(a.dtype.type, _nx.complexfloating): @@ -255,8 +307,25 @@ def asscalar(a): - """Convert an array of size 1 to its scalar equivalent. """ + Convert an array of size 1 to its scalar equivalent. + + Parameters + ---------- + a : ndarray + Input array. + + Returns + ------- + out : scalar + Scalar of size 1 array. + + Examples + -------- + >>> np.asscalar(np.array([24])) + >>> 24 + + """ return a.item() #----------------------------------------------------------------------------- @@ -322,19 +391,28 @@ """ Return the inexact scalar type which is most common in a list of arrays. - The return type will always be a inexact scalar type, even if all - the arrays are integer arrays + The return type will always be an inexact scalar type, even if all the + arrays are integer arrays Parameters ---------- - arrays: sequence of array_like - Input sequence of arrays. + array1, array2, ... : ndarray + Input arrays. Returns ------- - out: data type code + out : data type code Data type code. + See Also + -------- + dtype + + Examples + -------- + >>> np.common_type(np.arange(4), np.array([45,6]), np.array([45.0, 6.0])) + + """ is_complex = False precision = 0 Modified: branches/1.2.x/numpy/lib/ufunclike.py =================================================================== --- branches/1.2.x/numpy/lib/ufunclike.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/ufunclike.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -7,8 +7,39 @@ import numpy.core.numeric as nx def fix(x, y=None): - """ Round x to nearest integer towards zero. """ + Round to nearest integer towards zero. + + Round an array of floats element-wise to nearest integer towards zero. + The rounded values are returned as floats. + + Parameters + ---------- + x : array_like + An array of floats to be rounded + y : ndarray, optional + Output array + + Returns + ------- + out : ndarray of floats + The array of rounded numbers + + See Also + -------- + floor : Round downwards + around : Round to given number of decimals + + Examples + -------- + >>> np.fix(3.14) + 3.0 + >>> np.fix(3) + 3.0 + >>> np.fix([2.1, 2.9, -2.1, -2.9]) + array([ 2., 2., -2., -2.]) + + """ x = nx.asanyarray(x) if y is None: y = nx.zeros_like(x) @@ -19,8 +50,11 @@ def isposinf(x, y=None): """ - Return True where x is +infinity, and False otherwise. + Shows which elements of the input are positive infinity. + Returns a numpy array resulting from an element-wise test for positive + infinity. + Parameters ---------- x : array_like @@ -31,16 +65,54 @@ Returns ------- y : ndarray - A boolean array where y[i] = True only if x[i] = +Inf. + A numpy boolean array with the same dimensions as the input. + If second argument is not supplied then a numpy boolean array is returned + with values True where the corresponding element of the input is positive + infinity and values False where the element of the input is not positive + infinity. + If second argument is supplied then an numpy integer array is returned + with values 1 where the corresponding element of the input is positive + positive infinity. + See Also -------- - isneginf, isfinite + isinf : Shows which elements are negative or positive infinity. + isneginf : Shows which elements are negative infinity. + isnan : Shows which elements are Not a Number (NaN). + isfinite: Shows which elements are not: Not a number, positive and + negative infinity + Notes + ----- + Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + Also that positive infinity is not equivalent to negative infinity. But + infinity is equivalent to positive infinity. + + Errors result if second argument is also supplied with scalar input or + if first and second arguments have different shapes. + + Numpy's definitions for positive infinity (PINF) and negative infinity + (NINF) may be change in the future versions. + + Examples -------- + >>> np.isposinf(np.PINF) + array(True, dtype=bool) + >>> np.isposinf(np.inf) + array(True, dtype=bool) + >>> np.isposinf(np.NINF) + array(False, dtype=bool) >>> np.isposinf([-np.inf, 0., np.inf]) - array([ False, False, True], dtype=bool) + array([False, False, True], dtype=bool) + >>> x=np.array([-np.inf, 0., np.inf]) + >>> y=np.array([2,2,2]) + >>> np.isposinf(x,y) + array([1, 0, 0]) + >>> y + array([1, 0, 0]) """ if y is None: @@ -95,11 +167,10 @@ Returns ------- - y : {ndarray, scalar} + y : ndarray The logarithm to the base 2 of `x` elementwise. NaNs are returned where `x` is negative. - See Also -------- log, log1p, log10 Modified: branches/1.2.x/numpy/lib/utils.py =================================================================== --- branches/1.2.x/numpy/lib/utils.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/lib/utils.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -44,15 +44,23 @@ return d def get_numarray_include(type=None): - """Return the directory in the package that contains the numpy/*.h header - files. + """ + Return the directory that contains the numarray \\*.h header files. - Extension modules that need to compile against numpy should use this - function to locate the appropriate include directory. Using distutils: + Extension modules that need to compile against numarray should use this + function to locate the appropriate include directory. - import numpy - Extension('extension_name', ... - include_dirs=[numpy.get_numarray_include()]) + Notes + ----- + When using ``distutils``, for example in ``setup.py``. + :: + + import numpy as np + ... + Extension('extension_name', ... + include_dirs=[np.get_numarray_include()]) + ... + """ from numpy.numarray import get_numarray_include_dirs include_dirs = get_numarray_include_dirs() @@ -98,10 +106,7 @@ depdoc = '%s is DEPRECATED!! -- use %s instead' % (oldname, newname,) def newfunc(*args,**kwds): - """ - Use get_include, get_numpy_include is DEPRECATED. - - """ + """Use get_include, get_numpy_include is DEPRECATED.""" warnings.warn(str1, DeprecationWarning) return func(*args, **kwds) @@ -337,18 +342,30 @@ return thedict, dictlist def info(object=None,maxwidth=76,output=sys.stdout,toplevel='numpy'): - """Get help information for a function, class, or module. + """ + Get help information for a function, class, or module. - Example: - >>> np.info(np.polyval) # doctest: +SKIP + Parameters + ---------- + object : optional + Input object to get information about. + maxwidth : int, optional + Printing width. + output : file like object open for writing, optional + Write into file like object. + toplevel : string, optional + Start search at this level. - polyval(p, x) + Examples + -------- + >>> np.info(np.polyval) # doctest: +SKIP - Evaluate the polymnomial p at x. + polyval(p, x) - Description: - If p is of length N, this function returns the value: - p[0]*(x**N-1) + p[1]*(x**N-2) + ... + p[N-2]*x + p[N-1] + Evaluate the polymnomial p at x. + + ... + """ global _namedict, _dictlist # Local import to speed up numpy's import time. Modified: branches/1.2.x/numpy/linalg/linalg.py =================================================================== --- branches/1.2.x/numpy/linalg/linalg.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/linalg/linalg.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -1144,7 +1144,7 @@ Parameters ---------- - a : array-like, shape (M, M) + a : array_like, shape (M, M) Input array. Returns Modified: branches/1.2.x/numpy/ma/__init__.py =================================================================== --- branches/1.2.x/numpy/ma/__init__.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/ma/__init__.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -17,7 +17,7 @@ nan The mean is calculated using roughly ``np.sum(x)/len(x)``, but since -any number added to ``NaN`` [*]_ produces ``NaN``, this doesn't work. Enter +any number added to ``NaN`` [1]_ produces ``NaN``, this doesn't work. Enter masked arrays: >>> m = np.ma.masked_array(x, np.isnan(x)) @@ -32,7 +32,7 @@ >>> np.mean(m) 2.6666666666666665 -.. [*] Not-a-Number, a floating point value that is the result of an +.. [1] Not-a-Number, a floating point value that is the result of an invalid operation. """ Modified: branches/1.2.x/numpy/ma/core.py =================================================================== --- branches/1.2.x/numpy/ma/core.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/ma/core.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -986,14 +986,14 @@ # def masked_object(x, value, copy=True, shrink=True): """ - Mask the array ``x`` where the data are exactly equal to value. + Mask the array `x` where the data are exactly equal to value. This function is suitable only for object arrays: for floating - point, please use :func:`masked_values` instead. + point, please use `masked_values`_ instead. Parameters ---------- - x : array-like + x : array_like Array to mask value : var Comparison value @@ -1474,7 +1474,28 @@ view.__doc__ = ndarray.view.__doc__ #............................................. def astype(self, newtype): - """Returns a copy of the array cast to newtype.""" + """ + Returns a copy of the MaskedArray cast to given newtype. + + Returns + ------- + output : MaskedArray + A copy of self cast to input newtype. + The returned record shape matches self.shape. + + Examples + -------- + >>> x = np.ma.array([[1,2,3.1],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) + >>> print x + [[1.0 -- 3.1] + [-- 5.0 --] + [7.0 -- 9.0]] + >>> print x.astype(int32) + [[1 -- 3] + [-- 5 --] + [7 -- 9]] + + """ newtype = np.dtype(newtype) output = self._data.astype(newtype).view(type(self)) output._update_from(self) @@ -1862,8 +1883,26 @@ return result def compressed(self): - """Return a 1-D array of all the non-masked data. + """ + Return a 1-D array of all the non-masked data. + Returns + ------- + data : ndarray. + A new ndarray holding the non-masked data is returned. + + Notes + ----- + + The result is NOT a MaskedArray ! + + Examples + -------- + >>> x = array(arange(5), mask=[0]+[1]*4) + >>> print x.compressed() + [0] + >>> print type(x.compressed()) + + """ data = ndarray.ravel(self._data) if self._mask is not nomask: @@ -2169,7 +2208,26 @@ flatten = _arraymethod('flatten') # def ravel(self): - """Returns a 1D version of self, as a view.""" + """ + Returns a 1D version of self, as a view. + + Returns + ------- + MaskedArray + Output view is of shape ``(self.size,)`` (or + ``(np.ma.product(self.shape),)``). + + Examples + -------- + >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) + >>> print x + [[1 -- 3] + [-- 5 --] + [7 -- 9]] + >>> print x.ravel() + [1 -- 3 -- 5 -- 7 -- 9] + + """ r = ndarray.ravel(self._data).view(type(self)) r._update_from(self) if self._mask is not nomask: @@ -2182,28 +2240,41 @@ # def reshape (self, *s, **kwargs): """ - Returns a masked array containing the data of a, but with a new shape. - The result is a view to the original array; if this is not possible, - a ValueError is raised. + Returns a masked array containing the data of a, but with a new shape. + The result is a view to the original array; if this is not possible, + a ValueError is raised. - Parameters - ---------- - shape : shape tuple or int - The new shape should be compatible with the original shape. If an - integer, then the result will be a 1D array of that length. - order : {'C', 'F'}, optional - Determines whether the array data should be viewed as in C - (row-major) order or FORTRAN (column-major) order. + Parameters + ---------- + shape : shape tuple or int + The new shape should be compatible with the original shape. If an + integer, then the result will be a 1D array of that length. + order : {'C', 'F'}, optional + Determines whether the array data should be viewed as in C + (row-major) order or FORTRAN (column-major) order. - Returns - ------- - reshaped_array : array - A new view to the array. + Returns + ------- + reshaped_array : array + A new view to the array. - Notes - ----- - If you want to modify the shape in place, please use ``a.shape = s`` + Notes + ----- + If you want to modify the shape in place, please use ``a.shape = s`` + Examples + -------- + >>> x = np.ma.array([[1,2],[3,4]], mask=[1,0,0,1]) + >>> print x + [[-- 2] + [3 --]] + >>> x = x.reshape((4,1)) + >>> print x + [[--] + [2] + [3] + [--]] + """ kwargs.update(order=kwargs.get('order','C')) result = self._data.reshape(*s, **kwargs).view(type(self)) @@ -2235,14 +2306,49 @@ return None # def put(self, indices, values, mode='raise'): - """Set storage-indexed locations to corresponding values. + """ + Set storage-indexed locations to corresponding values. - a.put(values, indices, mode) sets a.flat[n] = values[n] for - each n in indices. If ``values`` is shorter than ``indices`` - then it will repeat. If ``values`` has some masked values, the - initial mask is updated in consequence, else the corresponding - values are unmasked. + Sets self._data.flat[n] = values[n] for each n in indices. + If `values` is shorter than `indices` then it will repeat. + If `values` has some masked values, the initial mask is updated + in consequence, else the corresponding values are unmasked. + Parameters + ---------- + indicies : 1-D array_like + Target indices, interpreted as integers. + values : array_like + Values to place in self._data copy at target indices. + mode : {'raise', 'wrap', 'clip'}, optional + Specifies how out-of-bounds indices will behave. + 'raise' : raise an error. + 'wrap' : wrap around. + 'clip' : clip to the range. + + Notes + ----- + `values` can be a scalar or length 1 array. + + Examples + -------- + >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) + >>> print x + [[1 -- 3] + [-- 5 --] + [7 -- 9]] + >>> x.put([0,4,8],[10,20,30]) + >>> print x + [[10 -- 3] + [-- 20 --] + [7 -- 30]] + + >>> x.put(4,999) + >>> print x + [[10 -- 3] + [-- 999 --] + [7 -- 30]] + """ m = self._mask # Hard mask: Get rid of the values/indices that fall on masked data @@ -2279,37 +2385,36 @@ #............................................ def all(self, axis=None, out=None): - """a.all(axis=None, out=None) + """ + Check if all of the elements of `a` are true. - Check if all of the elements of `a` are true. + Performs a :func:`logical_and` over the given axis and returns the result. + Masked values are considered as True during computation. + For convenience, the output array is masked where ALL the values along the + current axis are masked: if the output would have been a scalar and that + all the values are masked, then the output is `masked`. - Performs a :func:`logical_and` over the given axis and returns the result. - Masked values are considered as True during computation. - For convenience, the output array is masked where ALL the values along the - current axis are masked: if the output would have been a scalar and that - all the values are masked, then the output is `masked`. + Parameters + ---------- + axis : {None, integer} + Axis to perform the operation over. + If None, perform over flattened array. + out : {None, array}, optional + Array into which the result can be placed. Its type is preserved + and it must be of the right shape to hold the output. - Parameters - ---------- - axis : {None, integer} - Axis to perform the operation over. - If None, perform over flattened array. - out : {None, array}, optional - Array into which the result can be placed. Its type is preserved - and it must be of the right shape to hold the output. + See Also + -------- + all : equivalent function - See Also - -------- - all : equivalent function + Examples + -------- + >>> np.ma.array([1,2,3]).all() + True + >>> a = np.ma.array([1,2,3], mask=True) + >>> (a.all() is np.ma.masked) + True - Example - ------- - >>> np.ma.array([1,2,3]).all() - True - >>> a = np.ma.array([1,2,3], mask=True) - >>> (a.all() is np.ma.masked) - True - """ mask = self._mask.all(axis) if out is None: @@ -2327,26 +2432,25 @@ def any(self, axis=None, out=None): - """a.any(axis=None, out=None) + """ + Check if any of the elements of `a` are true. - Check if any of the elements of `a` are true. + Performs a logical_or over the given axis and returns the result. + Masked values are considered as False during computation. - Performs a logical_or over the given axis and returns the result. - Masked values are considered as False during computation. + Parameters + ---------- + axis : {None, integer} + Axis to perform the operation over. + If None, perform over flattened array and return a scalar. + out : {None, array}, optional + Array into which the result can be placed. Its type is preserved + and it must be of the right shape to hold the output. - Parameters - ---------- - axis : {None, integer} - Axis to perform the operation over. - If None, perform over flattened array and return a scalar. - out : {None, array}, optional - Array into which the result can be placed. Its type is preserved - and it must be of the right shape to hold the output. + See Also + -------- + any : equivalent function - See Also - -------- - any : equivalent function - """ mask = self._mask.all(axis) if out is None: @@ -2383,8 +2487,7 @@ def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None): - """a.trace(offset=0, axis1=0, axis2=1, dtype=None, out=None) - + """ Return the sum along the offset diagonal of the array's indicated `axis1` and `axis2`. @@ -2401,27 +2504,49 @@ def sum(self, axis=None, dtype=None, out=None): - """a.sum(axis=None, dtype=None, out=None) + """ + Return the sum of the array elements over the given axis. + Masked elements are set to 0 internally. - Return the sum of the array elements over the given axis. - Masked elements are set to 0 internally. + Parameters + ---------- + axis : {None, -1, int}, optional + Axis along which the sum is computed. The default + (`axis` = None) is to compute over the flattened array. + dtype : {None, dtype}, optional + Determines the type of the returned array and of the accumulator + where the elements are summed. If dtype has the value None and + the type of a is an integer type of precision less than the default + platform integer, then the default platform integer precision is + used. Otherwise, the dtype is the same as that of a. + out : {None, ndarray}, optional + Alternative output array in which to place the result. It must + have the same shape and buffer length as the expected output + but the type will be cast if necessary. - Parameters - ---------- - axis : {None, -1, int}, optional - Axis along which the sum is computed. The default - (`axis` = None) is to compute over the flattened array. - dtype : {None, dtype}, optional - Determines the type of the returned array and of the accumulator - where the elements are summed. If dtype has the value None and - the type of a is an integer type of precision less than the default - platform integer, then the default platform integer precision is - used. Otherwise, the dtype is the same as that of a. - out : {None, ndarray}, optional - Alternative output array in which to place the result. It must - have the same shape and buffer length as the expected output - but the type will be cast if necessary. + Returns + ------- + sum_along_axis : MaskedArray or scalar + An array with the same shape as self, with the specified + axis removed. If self is a 0-d array, or if `axis` is None, a scalar + is returned. If an output array is specified, a reference to + `out` is returned. + Examples + -------- + >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) + >>> print x + [[1 -- 3] + [-- 5 --] + [7 -- 9]] + >>> print x.sum() + 25 + >>> print x.sum(axis=1) + [4 5 16] + >>> print x.sum(axis=0) + [8 5 12] + >>> print type(x.sum(axis=0, dtype=np.int64)[0]) + """ _mask = ndarray.__getattribute__(self, '_mask') @@ -2506,53 +2631,53 @@ def prod(self, axis=None, dtype=None, out=None): """ - Return the product of the array elements over the given axis. - Masked elements are set to 1 internally for computation. + Return the product of the array elements over the given axis. + Masked elements are set to 1 internally for computation. - Parameters - ---------- - axis : {None, int}, optional - Axis over which the product is taken. If None is used, then the - product is over all the array elements. - dtype : {None, dtype}, optional - Determines the type of the returned array and of the accumulator - where the elements are multiplied. If ``dtype`` has the value ``None`` - and the type of a is an integer type of precision less than the default - platform integer, then the default platform integer precision is - used. Otherwise, the dtype is the same as that of a. - out : {None, array}, optional - Alternative output array in which to place the result. It must have - the same shape as the expected output but the type will be cast if - necessary. + Parameters + ---------- + axis : {None, int}, optional + Axis over which the product is taken. If None is used, then the + product is over all the array elements. + dtype : {None, dtype}, optional + Determines the type of the returned array and of the accumulator + where the elements are multiplied. If ``dtype`` has the value ``None`` + and the type of a is an integer type of precision less than the default + platform integer, then the default platform integer precision is + used. Otherwise, the dtype is the same as that of a. + out : {None, array}, optional + Alternative output array in which to place the result. It must have + the same shape as the expected output but the type will be cast if + necessary. - Returns - ------- - product_along_axis : {array, scalar}, see dtype parameter above. - Returns an array whose shape is the same as a with the specified - axis removed. Returns a 0d array when a is 1d or axis=None. - Returns a reference to the specified output array if specified. + Returns + ------- + product_along_axis : {array, scalar}, see dtype parameter above. + Returns an array whose shape is the same as a with the specified + axis removed. Returns a 0d array when a is 1d or axis=None. + Returns a reference to the specified output array if specified. - See Also - -------- - prod : equivalent function + See Also + -------- + prod : equivalent function - Examples - -------- - >>> np.prod([1.,2.]) - 2.0 - >>> np.prod([1.,2.], dtype=np.int32) - 2 - >>> np.prod([[1.,2.],[3.,4.]]) - 24.0 - >>> np.prod([[1.,2.],[3.,4.]], axis=1) - array([ 2., 12.]) + Notes + ----- + Arithmetic is modular when using integer types, and no error is raised + on overflow. - Notes - ----- - Arithmetic is modular when using integer types, and no error is raised - on overflow. + Examples + -------- + >>> np.prod([1.,2.]) + 2.0 + >>> np.prod([1.,2.], dtype=np.int32) + 2 + >>> np.prod([[1.,2.],[3.,4.]]) + 24.0 + >>> np.prod([[1.,2.],[3.,4.]], axis=1) + array([ 2., 12.]) - """ + """ _mask = ndarray.__getattribute__(self, '_mask') newmask = _mask.all(axis=axis) # No explicit output @@ -2716,6 +2841,16 @@ #............................................ def round(self, decimals=0, out=None): + """ + Return an array rounded a to the given number of decimals. + + Refer to `numpy.around` for full documentation. + + See Also + -------- + numpy.around : equivalent function + + """ result = self._data.round(decimals=decimals, out=out).view(type(self)) result._mask = self._mask result._update_from(self) @@ -2780,22 +2915,40 @@ def argmin(self, axis=None, fill_value=None, out=None): - """a.argmin(axis=None, out=None) + """ + Return array of indices to the minimum values along the given axis. - Return array of indices to the minimum values along the given axis. + Parameters + ---------- + axis : {None, integer} + If None, the index is into the flattened array, otherwise along + the specified axis + fill_value : {var}, optional + Value used to fill in the masked values. If None, the output of + minimum_fill_value(self._data) is used instead. + out : {None, array}, optional + Array into which the result can be placed. Its type is preserved + and it must be of the right shape to hold the output. - Parameters - ---------- - axis : {None, integer} - If None, the index is into the flattened array, otherwise along - the specified axis - fill_value : {var}, optional - Value used to fill in the masked values. If None, the output of - minimum_fill_value(self._data) is used instead. - out : {None, array}, optional - Array into which the result can be placed. Its type is preserved - and it must be of the right shape to hold the output. + Returns + ------- + {ndarray, scalar} + If multi-dimension input, returns a new ndarray of indices to the + minimum values along the given axis. Otherwise, returns a scalar + of index to the minimum values along the given axis. + Examples + -------- + >>> x = np.ma.array(arange(4), mask=[1,1,0,0]) + >>> x.shape = (2,2) + >>> print x + [[-- --] + [2 3]] + >>> print x.argmin(axis=0, fill_value=-1) + [0 0] + >>> print x.argmin(axis=0, fill_value=9) + [1 1] + """ if fill_value is None: fill_value = minimum_fill_value(self) @@ -2804,37 +2957,36 @@ def argmax(self, axis=None, fill_value=None, out=None): - """a.argmax(axis=None, out=None) + """ + Returns array of indices of the maximum values along the given axis. + Masked values are treated as if they had the value fill_value. - Returns array of indices of the maximum values along the given axis. - Masked values are treated as if they had the value fill_value. + Parameters + ---------- + axis : {None, integer} + If None, the index is into the flattened array, otherwise along + the specified axis + fill_value : {var}, optional + Value used to fill in the masked values. If None, the output of + maximum_fill_value(self._data) is used instead. + out : {None, array}, optional + Array into which the result can be placed. Its type is preserved + and it must be of the right shape to hold the output. - Parameters - ---------- - axis : {None, integer} - If None, the index is into the flattened array, otherwise along - the specified axis - fill_value : {var}, optional - Value used to fill in the masked values. If None, the output of - maximum_fill_value(self._data) is used instead. - out : {None, array}, optional - Array into which the result can be placed. Its type is preserved - and it must be of the right shape to hold the output. + Returns + ------- + index_array : {integer_array} - Returns - ------- - index_array : {integer_array} + Examples + -------- + >>> a = np.arange(6).reshape(2,3) + >>> a.argmax() + 5 + >>> a.argmax(0) + array([1, 1, 1]) + >>> a.argmax(1) + array([2, 2]) - Examples - -------- - >>> a = np.arange(6).reshape(2,3) - >>> a.argmax() - 5 - >>> a.argmax(0) - array([1, 1, 1]) - >>> a.argmax(1) - array([2, 2]) - """ if fill_value is None: fill_value = maximum_fill_value(self._data) @@ -2975,33 +3127,32 @@ #........................ def max(self, axis=None, out=None, fill_value=None): - """a.max(axis=None, out=None, fill_value=None) + """ + Return the maximum along a given axis. - Return the maximum along a given axis. + Parameters + ---------- + axis : {None, int}, optional + Axis along which to operate. By default, ``axis`` is None and the + flattened input is used. + out : array_like, optional + Alternative output array in which to place the result. Must + be of the same shape and buffer length as the expected output. + fill_value : {var}, optional + Value used to fill in the masked values. + If None, use the output of maximum_fill_value(). - Parameters - ---------- - axis : {None, int}, optional - Axis along which to operate. By default, ``axis`` is None and the - flattened input is used. - out : array_like, optional - Alternative output array in which to place the result. Must - be of the same shape and buffer length as the expected output. - fill_value : {var}, optional - Value used to fill in the masked values. - If None, use the output of maximum_fill_value(). + Returns + ------- + amax : array_like + New array holding the result. + If ``out`` was specified, ``out`` is returned. - Returns - ------- - amax : array_like - New array holding the result. - If ``out`` was specified, ``out`` is returned. + See Also + -------- + maximum_fill_value + Returns the maximum filling value for a given datatype. - See Also - -------- - maximum_fill_value - Returns the maximum filling value for a given datatype. - """ _mask = ndarray.__getattribute__(self, '_mask') newmask = _mask.all(axis=axis) @@ -3031,30 +3182,28 @@ return out def ptp(self, axis=None, out=None, fill_value=None): - """a.ptp(axis=None, out=None) + """ + Return (maximum - minimum) along the the given dimension + (i.e. peak-to-peak value). - Return (maximum - minimum) along the the given dimension - (i.e. peak-to-peak value). + Parameters + ---------- + axis : {None, int}, optional + Axis along which to find the peaks. If None (default) the + flattened array is used. + out : {None, array_like}, optional + Alternative output array in which to place the result. It must + have the same shape and buffer length as the expected output + but the type will be cast if necessary. + fill_value : {var}, optional + Value used to fill in the masked values. - Parameters - ---------- - axis : {None, int}, optional - Axis along which to find the peaks. If None (default) the - flattened array is used. - out : {None, array_like}, optional - Alternative output array in which to place the result. It must - have the same shape and buffer length as the expected output - but the type will be cast if necessary. - fill_value : {var}, optional - Value used to fill in the masked values. + Returns + ------- + ptp : ndarray. + A new array holding the result, unless ``out`` was + specified, in which case a reference to ``out`` is returned. - Returns - ------- - ptp : ndarray. - A new array holding the result, unless ``out`` was - specified, in which case a reference to ``out`` is returned. - - """ if out is None: result = self.max(axis=axis, fill_value=fill_value) @@ -3116,8 +3265,7 @@ def tostring(self, fill_value=None, order='C'): """ Return a copy of array data as a Python string containing the raw bytes - in the array. - The array is filled beforehand. + in the array. The array is filled beforehand. Parameters ---------- @@ -3125,15 +3273,15 @@ Value used to fill in the masked values. If None, uses self.fill_value instead. order : {string} - Order of the data item in the copy {"C","F","A"}. - "C" -- C order (row major) - "Fortran" -- Fortran order (column major) - "Any" -- Current order of array. + Order of the data item in the copy {'C','F','A'}. + 'C' -- C order (row major) + 'Fortran' -- Fortran order (column major) + 'Any' -- Current order of array. None -- Same as "Any" - Warnings - -------- - As for :meth:`ndarray.tostring`, information about the shape, dtype..., + Notes + ----- + As for method:`ndarray.tostring`, information about the shape, dtype..., but also fill_value will be lost. """ @@ -3143,15 +3291,35 @@ raise NotImplementedError("Not implemented yet, sorry...") def torecords(self): - """Transforms a masked array into a flexible-type array with two fields: + """ + Transforms a MaskedArray into a flexible-type array with two fields: * the ``_data`` field stores the ``_data`` part of the array; * the ``_mask`` field stores the ``_mask`` part of the array; - Warnings - -------- + Returns + ------- + record : ndarray + A new flexible-type ndarray with two fields: the first element + containing a value, the second element containing the corresponding + mask boolean. The returned record shape matches self.shape. + + Notes + ----- A side-effect of transforming a masked array into a flexible ndarray is - that metainformation (``fill_value``, ...) will be lost. + that meta information (``fill_value``, ...) will be lost. + Examples + -------- + >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) + >>> print x + [[1 -- 3] + [-- 5 --] + [7 -- 9]] + >>> print x.torecords() + [[(1, False) (2, True) (3, False)] + [(4, True) (5, False) (6, True)] + [(7, False) (8, True) (9, False)]] + """ # Get the basic dtype .... ddtype = self.dtype Modified: branches/1.2.x/numpy/ma/extras.py =================================================================== --- branches/1.2.x/numpy/ma/extras.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/ma/extras.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -371,29 +371,30 @@ def median(a, axis=None, out=None, overwrite_input=False): - """Compute the median along the specified axis. + """ + Compute the median along the specified axis. Returns the median of the array elements. Parameters ---------- - a : array-like + a : array_like Input array or object that can be converted to an array - axis : {None, int}, optional - Axis along which the medians are computed. The default (axis=None) is to - compute the median along a flattened version of the array. - out : {None, ndarray}, optional + axis : int, optional + Axis along which the medians are computed. The default (axis=None) is + to compute the median along a flattened version of the array. + out : ndarray, optional Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type will be cast if necessary. overwrite_input : {False, True}, optional - If True, then allow use of memory of input array (a) for - calculations. The input array will be modified by the call to - median. This will save memory when you do not need to preserve - the contents of the input array. Treat the input as undefined, - but it will probably be fully or partially sorted. Default is - False. Note that, if overwrite_input is true, and the input - is not already an ndarray, an error will be raised. + If True, then allow use of memory of input array (a) for + calculations. The input array will be modified by the call to + median. This will save memory when you do not need to preserve + the contents of the input array. Treat the input as undefined, + but it will probably be fully or partially sorted. Default is + False. Note that, if overwrite_input is true, and the input + is not already an ndarray, an error will be raised. Returns ------- @@ -404,7 +405,7 @@ float64, or the input datatype otherwise. See Also - ------- + -------- mean Notes @@ -697,36 +698,40 @@ def cov(x, y=None, rowvar=True, bias=False, allow_masked=True): - """Estimates the covariance matrix. + """ + Estimates the covariance matrix. Normalization is by (N-1) where N is the number of observations (unbiased estimate). If bias is True then normalization is by N. By default, masked values are recognized as such. If x and y have the same - shape, a common mask is allocated: if x[i,j] is masked, then y[i,j] will also - be masked. - Setting `allow_masked` to False will raise an exception if values are missing - in either of the input arrays. + shape, a common mask is allocated: if x[i,j] is masked, then y[i,j] will + also be masked. + Setting `allow_masked` to False will raise an exception if values are + missing in either of the input arrays. Parameters ---------- - x : array-like + x : array_like Input data. If x is a 1D array, returns the variance. If x is a 2D array, returns the covariance matrix. - y : {None, array-like}, optional + y : array_like, optional Optional set of variables. rowvar : {False, True} optional - If rowvar is true, then each row is a variable with observations in columns. - If rowvar is False, each column is a variable and the observations are in - the rows. + If rowvar is true, then each row is a variable with observations in + columns. + If rowvar is False, each column is a variable and the observations are + in the rows. bias : {False, True} optional - Whether to use a biased (True) or unbiased (False) estimate of the covariance. - If bias is True, then the normalization is by N, the number of observations. + Whether to use a biased (True) or unbiased (False) estimate of the + covariance. + If bias is True, then the normalization is by N, the number of + observations. Otherwise, the normalization is by (N-1). allow_masked : {True, False} optional - If True, masked values are propagated pair-wise: if a value is masked in x, - the corresponding value is masked in y. + If True, masked values are propagated pair-wise: if a value is masked + in x, the corresponding value is masked in y. If False, raises a ValueError exception when some values are missing. Raises Modified: branches/1.2.x/numpy/matlib.py =================================================================== --- branches/1.2.x/numpy/matlib.py 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/matlib.py 2008-10-28 00:53:04 UTC (rev 5966) @@ -14,28 +14,163 @@ return ndarray.__new__(matrix, shape, dtype, order=order) def ones(shape, dtype=None, order='C'): - """return a matrix initialized to all ones """ + Matrix of ones. + + Return a matrix of given shape and type, filled with ones. + + Parameters + ---------- + shape : {sequence of ints, int} + Shape of the matrix + dtype : data-type, optional + The desired data-type for the matrix, default is np.float64. + order : {'C', 'F'}, optional + Whether to store matrix in C- or Fortran-contiguous order, + default is 'C'. + + Returns + ------- + out : matrix + Matrix of ones of given shape, dtype, and order. + + See Also + -------- + ones : Array of ones. + matlib.zeros : Zero matrix. + + Notes + ----- + If `shape` has length one i.e. ``(N,)``, or is a scalar ``N``, + `out` becomes a single row matrix of shape ``(1,N)``. + + Examples + -------- + >>> np.matlib.ones((2,3)) + matrix([[ 1., 1., 1.], + [ 1., 1., 1.]]) + + >>> np.matlib.ones(2) + matrix([[ 1., 1.]] + + """ a = ndarray.__new__(matrix, shape, dtype, order=order) a.fill(1) return a def zeros(shape, dtype=None, order='C'): - """return a matrix initialized to all zeros """ + Zero matrix. + + Return a matrix of given shape and type, filled with zeros + + Parameters + ---------- + shape : {sequence of ints, int} + Shape of the matrix + dtype : data-type, optional + The desired data-type for the matrix, default is np.float64. + order : {'C', 'F'}, optional + Whether to store the result in C- or Fortran-contiguous order, + default is 'C'. + + Returns + ------- + out : matrix + Zero matrix of given shape, dtype, and order. + + See Also + -------- + zeros : Zero array. + matlib.ones : Matrix of ones. + + Notes + ----- + If `shape` has length one i.e. ``(N,)``, or is a scalar ``N``, + `out` becomes a single row matrix of shape ``(1,N)``. + + Examples + -------- + >>> np.matlib.zeros((2,3)) + matrix([[ 0., 0., 0.], + [ 0., 0., 0.]]) + + >>> np.matlib.zeros(2) + matrix([[ 0., 0.]] + + """ a = ndarray.__new__(matrix, shape, dtype, order=order) a.fill(0) return a def identity(n,dtype=None): - """identity(n) returns the identity matrix of shape n x n. """ + Returns the square identity matrix of given size. + + Parameters + ---------- + n : int + Size of identity matrix + + dtype : data-type, optional + Data-type of the output. Defaults to ``float``. + + Returns + ------- + out : matrix + `n` x `n` matrix with its main diagonal set to one, + and all other elements zero. + + See Also + -------- + identity : Equivalent array function. + matlib.eye : More general matrix identity function. + + Notes + ----- + For more detailed documentation, see the docstring of the equivalent + array function ``np.identity`` + + """ a = array([1]+n*[0],dtype=dtype) b = empty((n,n),dtype=dtype) b.flat = a return b def eye(n,M=None, k=0, dtype=float): + """ + Return a matrix with ones on the diagonal and zeros elsewhere. + + Parameters + ---------- + n : int + Number of rows in the output. + M : int, optional + Number of columns in the output, defaults to n. + k : int, optional + Index of the diagonal: 0 refers to the main diagonal, + a positive value refers to an upper diagonal, + and a negative value to a lower diagonal. + dtype : dtype, optional + Data-type of the returned matrix. + + Returns + ------- + I : matrix + A `n` x `M` matrix where all elements are equal to zero, + except for the k-th diagonal, whose values are equal to one. + + See Also + -------- + eye : Equivalent array function + matlib.identity : Square identity matrix + + Notes + ----- + For more detailed docuemtation, see the docstring of the equivalent + array function ``np.eye``. + + """ return asmatrix(np.eye(n,M,k,dtype)) def rand(*args): Modified: branches/1.2.x/numpy/random/mtrand/mtrand.pyx =================================================================== --- branches/1.2.x/numpy/random/mtrand/mtrand.pyx 2008-10-28 00:38:35 UTC (rev 5965) +++ branches/1.2.x/numpy/random/mtrand/mtrand.pyx 2008-10-28 00:53:04 UTC (rev 5966) @@ -532,7 +532,7 @@ Parameters ---------- - seed : {None, int, array-like} + 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``. @@ -1160,8 +1160,71 @@ """ gamma(shape, scale=1.0, size=None) - Gamma distribution. + 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 @@ -1188,8 +1251,82 @@ """ f(dfnum, dfden, size=None) - F distribution. + 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 @@ -1831,8 +1968,8 @@ >>> 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) ), + >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta) + ... * np.exp( -np.exp( -(bins - mu) /beta) ), ... linewidth=2, color='r') >>> plt.show() @@ -1848,11 +1985,11 @@ >>> 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) ), + >>> 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) ), + >>> plt.plot(bins, 1/(beta * np.sqrt(2 * np.pi)) + ... * np.exp(-(bins - mu)**2 / (2 * beta**2)), ... linewidth=2, color='g') >>> plt.show() @@ -1878,8 +2015,72 @@ """ logistic(loc=0.0, scale=1.0, size=None) - Logistic distribution. + 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 @@ -2126,8 +2327,82 @@ """ binomial(n, p, size=None) - Binomial distribution of n trials and p probability of success. + 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 @@ -2377,13 +2652,85 @@ """ hypergeometric(ngood, nbad, nsample, size=None) - Hypergeometric distribution. + Draw samples from a Hypergeometric distribution. - Consider an urn with ngood "good" balls and nbad "bad" balls. If one - were to draw nsample balls from the urn without replacement, then - the hypergeometric distribution describes the distribution of "good" - balls in the sample. + 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 @@ -2424,8 +2771,75 @@ """ logseries(p, size=None) - Logarithmic series distribution. + 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 From numpy-svn at scipy.org Mon Oct 27 21:03:36 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 27 Oct 2008 20:03:36 -0500 (CDT) Subject: [Numpy-svn] r5967 - branches/1.2.x/numpy/random/mtrand Message-ID: <20081028010336.60A4139C089@scipy.org> Author: ptvirtan Date: 2008-10-27 20:03:19 -0500 (Mon, 27 Oct 2008) New Revision: 5967 Modified: branches/1.2.x/numpy/random/mtrand/mtrand.c Log: 1.2.x: Backport r5964 from trunk: Regenerate mtrand.c due to docstring changes Modified: branches/1.2.x/numpy/random/mtrand/mtrand.c =================================================================== --- branches/1.2.x/numpy/random/mtrand/mtrand.c 2008-10-28 00:53:04 UTC (rev 5966) +++ branches/1.2.x/numpy/random/mtrand/mtrand.c 2008-10-28 01:03:19 UTC (rev 5967) @@ -1,4 +1,4 @@ -/* Generated by Pyrex 0.9.6.4 on Sun Aug 24 16:14:30 2008 */ +/* 0.9.7 on Tue Oct 28 02:15:49 2008 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -247,7 +247,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":131 */ + /* "/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;} @@ -258,7 +258,7 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":134 */ + /* "/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; @@ -278,18 +278,18 @@ arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":135 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":135 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":136 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":136 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":137 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":139 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":139 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -323,7 +323,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":148 */ + /* "/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;} @@ -334,7 +334,7 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":151 */ + /* "/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; @@ -354,18 +354,18 @@ arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":152 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":152 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":153 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":153 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":154 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":156 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":156 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -386,8 +386,6 @@ return __pyx_r; } -static PyObject *__pyx_n_ValueError; - static PyObject *__pyx_k61p; static char __pyx_k61[] = "size is not compatible with inputs"; @@ -412,44 +410,44 @@ __pyx_v_itera = ((PyArrayIterObject *)Py_None); Py_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":167 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":167 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":168 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":169 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":169 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":170 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":170 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":171 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":172 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":173 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":174 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":174 */ PyArray_ITER_NEXT(__pyx_v_itera); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":176 */ + /* "/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; @@ -469,50 +467,48 @@ arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":177 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":177 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":178 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":180 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; goto __pyx_L1;} + __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_4, 0, __pyx_k61p); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; goto __pyx_L1;} + 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_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":182 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":183 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":184 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":185 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":185 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,1); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":186 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":186 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -547,7 +543,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":195 */ + /* "/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;} @@ -558,7 +554,7 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":198 */ + /* "/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; @@ -578,18 +574,18 @@ arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":199 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":199 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":200 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":200 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":201 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":203 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":203 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -633,48 +629,48 @@ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":216 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":216 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":217 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":218 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":219 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":219 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":220 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":221 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":222 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":223 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":224 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":224 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":226 */ + /* "/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; @@ -694,56 +690,54 @@ arrayObject = ((PyArrayObject *)__pyx_5); Py_DECREF(__pyx_5); __pyx_5 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":227 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":227 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":228 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":229 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} + __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_5, 0, __pyx_k62p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":231 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":232 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":233 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":234 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":235 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":235 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,1); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":236 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":236 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,2); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":237 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":237 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -778,7 +772,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":247 */ + /* "/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;} @@ -789,7 +783,7 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":250 */ + /* "/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; @@ -809,18 +803,18 @@ arrayObject = ((PyArrayObject *)__pyx_4); Py_DECREF(__pyx_4); __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":251 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":251 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":252 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":252 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":253 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":255 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":255 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -866,51 +860,51 @@ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":269 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":269 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":270 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":271 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":272 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":272 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":273 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":274 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":275 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":276 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":277 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":278 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":278 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":280 */ + /* "/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; @@ -930,56 +924,54 @@ arrayObject = ((PyArrayObject *)__pyx_5); Py_DECREF(__pyx_5); __pyx_5 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":281 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":281 */ __pyx_v_array_data = ((double *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":282 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":284 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;} + __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_5, 0, __pyx_k63p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":286 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":287 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":288 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":289 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":290 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":291 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":291 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":292 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":292 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1002,8 +994,6 @@ return __pyx_r; } -static PyObject *__pyx_n_int; - 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; @@ -1017,7 +1007,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":300 */ + /* "/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;} @@ -1028,36 +1018,35 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":303 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":304 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":304 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":305 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":305 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":306 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":308 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":308 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1091,7 +1080,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":316 */ + /* "/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;} @@ -1102,36 +1091,35 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":319 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":320 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":320 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":321 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":321 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":322 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":324 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":324 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1175,115 +1163,112 @@ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":335 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":335 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":336 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":337 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":338 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":338 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":339 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":340 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":341 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":342 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":343 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":343 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":345 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;} + __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_5, 0, __pyx_v_size); - 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 = 345; goto __pyx_L1;} + 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_5); __pyx_5 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":346 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":346 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":347 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":348 */ + /* "/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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;} __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_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_Raise(__pyx_5, 0, 0); + Py_DECREF(__pyx_5); __pyx_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":350 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":351 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":352 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":353 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":354 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":354 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,1); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":355 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":355 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,2); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":357 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":357 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1318,7 +1303,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":365 */ + /* "/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;} @@ -1329,36 +1314,35 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":368 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":369 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":369 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":370 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":370 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":371 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":373 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":373 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1402,115 +1386,112 @@ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":384 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":384 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":385 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":386 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":387 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":387 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":388 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":389 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":390 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":391 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":392 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":392 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":394 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; goto __pyx_L1;} + __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_5, 0, __pyx_v_size); - 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 = 394; goto __pyx_L1;} + 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_5); __pyx_5 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":395 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":395 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":396 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":397 */ + /* "/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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} __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_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_Raise(__pyx_5, 0, 0); + Py_DECREF(__pyx_5); __pyx_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":399 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":400 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":401 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":402 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":403 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":403 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,1); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":404 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":404 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,2); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":406 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":406 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1545,7 +1526,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":415 */ + /* "/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;} @@ -1556,36 +1537,35 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":418 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":419 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":419 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":420 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":420 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":421 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":423 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":423 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1631,118 +1611,115 @@ arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":436 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":436 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":437 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":438 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":439 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":439 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":440 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":441 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":442 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":443 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":444 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":445 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":445 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":447 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; goto __pyx_L1;} + __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_5, 0, __pyx_v_size); - 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 = 447; goto __pyx_L1;} + 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_5); __pyx_5 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":448 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":448 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":449 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":451 */ + /* "/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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;} __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_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; + __Pyx_Raise(__pyx_5, 0, 0); + Py_DECREF(__pyx_5); __pyx_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":453 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":454 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":455 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":456 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":457 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":458 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":458 */ PyArray_MultiIter_NEXT(__pyx_v_multi); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":460 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":460 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1778,7 +1755,7 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":468 */ + /* "/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;} @@ -1789,36 +1766,35 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":471 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":472 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":472 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":473 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":473 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":474 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":476 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":476 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1863,105 +1839,102 @@ __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None); __pyx_v_itera = ((PyArrayIterObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":487 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":487 */ __pyx_1 = __pyx_v_size == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":488 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":489 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":489 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":490 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":490 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":491 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":492 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":493 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":494 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":494 */ PyArray_ITER_NEXT(__pyx_v_itera); } goto __pyx_L2; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":496 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2))); - Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_2); 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":497 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":497 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":498 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":499 */ + /* "/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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;} __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_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":501 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":502 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":503 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":504 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":504 */ PyArray_MultiIter_NEXTi(__pyx_v_multi,1); } } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":505 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":505 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -1991,29 +1964,29 @@ long __pyx_v_i; double __pyx_r; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":510 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":510 */ __pyx_v_sum = (__pyx_v_darr[0]); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":511 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":511 */ __pyx_v_c = 0.0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":512 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":513 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":514 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":514 */ __pyx_v_t = (__pyx_v_sum + __pyx_v_y); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":515 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":516 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":516 */ __pyx_v_sum = __pyx_v_t; } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":517 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":517 */ __pyx_r = __pyx_v_sum; goto __pyx_L0; @@ -2035,10 +2008,10 @@ Py_INCREF(__pyx_v_self); Py_INCREF(__pyx_v_seed); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":547 */ + /* "/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)))); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":549 */ + /* "/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); @@ -2069,10 +2042,10 @@ __pyx_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != NULL); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":553 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":554 */ + /* "/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; } @@ -2081,7 +2054,6 @@ Py_DECREF(__pyx_v_self); } -static PyObject *__pyx_n_type; static PyObject *__pyx_n_integer; static PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ @@ -2095,8 +2067,7 @@ int __pyx_1; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - unsigned long __pyx_5; + 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; @@ -2105,62 +2076,56 @@ arrayObject_obj = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_iseed = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":570 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; goto __pyx_L1;} + __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_3, 0, __pyx_v_seed); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; goto __pyx_L1;} + 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; - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; goto __pyx_L1;} - __pyx_1 = __pyx_4 == __pyx_2; - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_1) { - __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; goto __pyx_L1;} - rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); + __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_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_integer); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; goto __pyx_L1;} + __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; - __pyx_1 = PyObject_IsInstance(__pyx_v_seed,__pyx_4); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":575 */ - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; goto __pyx_L1;} + /* "/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_3, 0, __pyx_v_seed); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; goto __pyx_L1;} + 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_3); __pyx_3 = 0; Py_DECREF(__pyx_v_iseed); - __pyx_v_iseed = __pyx_4; - __pyx_4 = 0; + __pyx_v_iseed = __pyx_3; + __pyx_3 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":576 */ - __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_v_iseed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;} - rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state); + /* "/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*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":578 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":579 */ + /* "/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:; @@ -2170,7 +2135,6 @@ __pyx_L1:; Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); __Pyx_AddTraceback("mtrand.RandomState.seed"); __pyx_r = 0; __pyx_L0:; @@ -2201,7 +2165,7 @@ Py_INCREF(__pyx_v_self); arrayObject_state = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":592 */ + /* "/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; @@ -2222,10 +2186,10 @@ arrayObject_state = ((PyArrayObject *)__pyx_1); Py_DECREF(__pyx_1); __pyx_1 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":593 */ + /* "/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)))); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":594 */ + /* "/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; @@ -2245,7 +2209,7 @@ arrayObject_state = ((PyArrayObject *)__pyx_3); Py_DECREF(__pyx_3); __pyx_3 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":595 */ + /* "/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;} @@ -2279,8 +2243,6 @@ return __pyx_r; } -static PyObject *__pyx_n_TypeError; - static PyObject *__pyx_k70p; static PyObject *__pyx_k71p; @@ -2299,10 +2261,10 @@ PyObject *__pyx_v_cached_gaussian; PyObject *__pyx_r; PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - int __pyx_3; - PyObject *__pyx_4 = 0; - Py_ssize_t __pyx_5; + 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}; @@ -2315,83 +2277,79 @@ __pyx_v_has_gauss = Py_None; Py_INCREF(Py_None); __pyx_v_cached_gaussian = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":614 */ - __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + /* "/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_2; - __pyx_2 = 0; + __pyx_v_algorithm_name = __pyx_1; + __pyx_1 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":615 */ - if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;} - __pyx_3 = __pyx_3 != 0; - if (__pyx_3) { - __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; goto __pyx_L1;} + /* "/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_2, 0, __pyx_k70p); - __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_2); __pyx_2 = 0; - __Pyx_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":617 */ + /* "/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_2 = PyObject_GetIter(__pyx_1); if (!__pyx_2) {__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_4 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;} + __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_4; - __pyx_4 = 0; - __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;} - __pyx_3 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;} + __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_3; - if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":618 */ - __pyx_5 = PyObject_Length(__pyx_v_state); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;} - __pyx_3 = (__pyx_5 == 3); - if (__pyx_3) { + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":619 */ - __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; goto __pyx_L1;} + /* "/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_4; - __pyx_4 = 0; + __pyx_v_has_gauss = __pyx_1; + __pyx_1 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":620 */ - __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; goto __pyx_L1;} + /* "/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_1; - __pyx_1 = 0; + __pyx_v_cached_gaussian = __pyx_3; + __pyx_3 = 0; goto __pyx_L3; } /*else*/ { - __pyx_2 = PySequence_GetSlice(__pyx_v_state, 3, 5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;} - __pyx_4 = PyObject_GetIter(__pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_1 = __Pyx_UnpackItem(__pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;} + __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_2 = __Pyx_UnpackItem(__pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;} + __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_2; - __pyx_2 = 0; - if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":623 */ + /* "/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))); @@ -2401,58 +2359,53 @@ } goto __pyx_L5; __pyx_L4:; - Py_XDECREF(__pyx_2); __pyx_2 = 0; - Py_XDECREF(__pyx_4); __pyx_4 = 0; + Py_XDECREF(__pyx_3); __pyx_3 = 0; Py_XDECREF(__pyx_1); __pyx_1 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":625 */ - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; goto __pyx_L1;} - __pyx_3 = PyErr_ExceptionMatches(__pyx_2); - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (__pyx_3) { + /* "/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_4, &__pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; goto __pyx_L1;} + 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_4); __pyx_4 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_5); __pyx_5 = 0; goto __pyx_L5; } goto __pyx_L1; __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":628 */ - __pyx_3 = ((arrayObject_obj->dimensions[0]) != 624); - if (__pyx_3) { - __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; goto __pyx_L1;} + /* "/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_4, 0, __pyx_k71p); - __pyx_1 = PyObject_CallObject(__pyx_6, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __Pyx_Raise(__pyx_1, 0, 0); - 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 = 629; goto __pyx_L1;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":630 */ + /* "/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)))); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":631 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":632 */ - __pyx_3 = 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_3; + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":633 */ + /* "/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; @@ -2460,8 +2413,8 @@ goto __pyx_L0; __pyx_L1:; Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_4); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_5); Py_XDECREF(__pyx_6); __Pyx_AddTraceback("mtrand.RandomState.set_state"); __pyx_r = 0; @@ -2673,51 +2626,49 @@ Py_INCREF(__pyx_v_size); arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":698 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":698 */ __pyx_1 = __pyx_v_high == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":699 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":699 */ __pyx_v_lo = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":700 */ + /* "/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*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":702 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":703 */ + /* "/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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":705 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":705 */ __pyx_v_diff = ((__pyx_v_hi - __pyx_v_lo) - 1); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":706 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":706 */ __pyx_1 = (__pyx_v_diff < 0); if (__pyx_1) { - __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; goto __pyx_L1;} + __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_4, 0, __pyx_k72p); - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; goto __pyx_L1;} + 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_Raise(__pyx_5, 0, 0); - Py_DECREF(__pyx_5); __pyx_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":709 */ + /* "/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;} @@ -2728,36 +2679,35 @@ } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":712 */ + /* "/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_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__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_3 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;} __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); - 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 = 712; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + 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_3))); + Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_5))); Py_DECREF(((PyObject *)arrayObject)); - arrayObject = ((PyArrayObject *)__pyx_3); - Py_DECREF(__pyx_3); __pyx_3 = 0; + arrayObject = ((PyArrayObject *)__pyx_5); + Py_DECREF(__pyx_5); __pyx_5 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":713 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":713 */ __pyx_v_length = PyArray_SIZE(arrayObject); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":714 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":714 */ __pyx_v_array_data = ((long *)arrayObject->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":715 */ + /* "/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))); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":717 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":717 */ Py_INCREF(((PyObject *)arrayObject)); __pyx_r = ((PyObject *)arrayObject); goto __pyx_L0; @@ -2794,19 +2744,19 @@ Py_INCREF(__pyx_v_self); __pyx_v_bytestring = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":742 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":743 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":743 */ __pyx_v_bytes = PyString_AS_STRING(__pyx_v_bytestring); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":744 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":745 */ + /* "/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; @@ -2856,13 +2806,13 @@ __pyx_v_odiff = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_temp = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":822 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":822 */ __pyx_v_flow = PyFloat_AsDouble(__pyx_v_low); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":823 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":823 */ __pyx_v_fhigh = PyFloat_AsDouble(__pyx_v_high); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":824 */ + /* "/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;} @@ -2873,24 +2823,24 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":826 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":826 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":827 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":828 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":829 */ + /* "/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; @@ -2906,17 +2856,17 @@ __pyx_v_temp = __pyx_4; __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":830 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":830 */ Py_INCREF(__pyx_v_temp); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":832 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":833 */ + /* "/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; @@ -3088,16 +3038,16 @@ Py_INCREF(__pyx_v_high); Py_INCREF(__pyx_v_size); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":904 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":904 */ __pyx_1 = __pyx_v_high == Py_None; if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":905 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":906 */ + /* "/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; @@ -3106,7 +3056,7 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":907 */ + /* "/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;} @@ -3206,34 +3156,32 @@ __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1004 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1004 */ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1005 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1005 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1006 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1006 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1007 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1007 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;} + __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_3, 0, __pyx_k74p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1009 */ + /* "/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; @@ -3242,54 +3190,52 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1011 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1011 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1013 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1014 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1015 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} + __pyx_v_oscale = ((PyArrayObject *)__pyx_2); 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 = 1015; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; goto __pyx_L1;} __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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; @@ -3298,10 +3244,10 @@ } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1017 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -3359,51 +3305,47 @@ __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_ob = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1059 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1059 */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1060 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1060 */ __pyx_v_fb = PyFloat_AsDouble(__pyx_v_b); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1061 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1061 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1062 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1062 */ __pyx_1 = (__pyx_v_fa <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; goto __pyx_L1;} + __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_3, 0, __pyx_k76p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1064 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1064 */ __pyx_1 = (__pyx_v_fb <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; goto __pyx_L1;} + __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_3, 0, __pyx_k77p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1066 */ + /* "/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; @@ -3412,54 +3354,52 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1068 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1068 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1070 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1071 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_b,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1072 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} + __pyx_v_ob = ((PyArrayObject *)__pyx_2); 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 = 1072; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; goto __pyx_L1;} __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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; @@ -3468,49 +3408,47 @@ } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1074 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + /* "/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_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;} + 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_5); - __pyx_5 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + 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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; goto __pyx_L1;} __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - 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 = 1075; goto __pyx_L1;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1076 */ - __pyx_3 = __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_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;} - __pyx_r = __pyx_3; - __pyx_3 = 0; + /* "/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); @@ -3560,31 +3498,29 @@ Py_INCREF(__pyx_v_size); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1115 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1115 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1116 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1116 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1117 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1117 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; goto __pyx_L1;} + __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_3, 0, __pyx_k80p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1119 */ + /* "/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; @@ -3593,59 +3529,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1121 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1121 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1123 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1124 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; 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 = 1124; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; 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 = 1124; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;} + 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_3); - __pyx_3 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; goto __pyx_L1;} __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1126 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -3720,31 +3654,29 @@ Py_INCREF(__pyx_v_size); __pyx_v_oshape = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1147 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1147 */ __pyx_v_fshape = PyFloat_AsDouble(__pyx_v_shape); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1148 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1148 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1149 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1149 */ __pyx_1 = (__pyx_v_fshape <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;} + __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_3, 0, __pyx_k82p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1151 */ + /* "/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; @@ -3753,59 +3685,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1153 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1153 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1154 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1155 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; 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 = 1155; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; 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 = 1155; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;} + 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_3); - __pyx_3 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; goto __pyx_L1;} __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1157 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -3836,7 +3766,7 @@ 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 Gamma distribution.\n\n "; +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; @@ -3862,52 +3792,48 @@ __pyx_v_oshape = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1169 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1232 */ __pyx_v_fshape = PyFloat_AsDouble(__pyx_v_shape); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1170 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1233 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1171 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1234 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1172 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1235 */ __pyx_1 = (__pyx_v_fshape <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; goto __pyx_L1;} + __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_3, 0, __pyx_k84p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1174 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1237 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; goto __pyx_L1;} + __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_3, 0, __pyx_k85p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1176 */ - __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 = 1176; goto __pyx_L1;} + /* "/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; @@ -3915,105 +3841,101 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1178 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1241 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1179 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_shape,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1180 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1181 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} + __pyx_v_oscale = ((PyArrayObject *)__pyx_2); 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 = 1181; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1182; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1183 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} + /* "/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_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;} + 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 = 1183; 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 = 1183; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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 = 1183; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1185 */ - __pyx_3 = __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_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; goto __pyx_L1;} - __pyx_r = __pyx_3; - __pyx_3 = 0; + /* "/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); @@ -4046,7 +3968,7 @@ 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 F distribution.\n\n "; +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; @@ -4071,52 +3993,48 @@ __pyx_v_odfnum = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_odfden = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1197 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1334 */ __pyx_v_fdfnum = PyFloat_AsDouble(__pyx_v_dfnum); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1198 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1335 */ __pyx_v_fdfden = PyFloat_AsDouble(__pyx_v_dfden); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1199 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1336 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1200 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1337 */ __pyx_1 = (__pyx_v_fdfnum <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;} + __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_3, 0, __pyx_k88p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1202 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1339 */ __pyx_1 = (__pyx_v_fdfden <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;} + __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_3, 0, __pyx_k89p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1204 */ - __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 = 1204; goto __pyx_L1;} + /* "/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; @@ -4124,105 +4042,101 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1206 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1343 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1208 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_dfnum,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1209 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_dfden,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1210 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} + __pyx_v_odfden = ((PyArrayObject *)__pyx_2); 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 = 1210; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1211; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1212 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} + /* "/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_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;} + 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 = 1212; 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 = 1212; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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 = 1212; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1214 */ - __pyx_3 = __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_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; goto __pyx_L1;} - __pyx_r = __pyx_3; - __pyx_3 = 0; + /* "/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); @@ -4291,72 +4205,66 @@ __pyx_v_odfden = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_ononc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1226 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1363 */ __pyx_v_fdfnum = PyFloat_AsDouble(__pyx_v_dfnum); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1227 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1364 */ __pyx_v_fdfden = PyFloat_AsDouble(__pyx_v_dfden); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1228 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1365 */ __pyx_v_fnonc = PyFloat_AsDouble(__pyx_v_nonc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1229 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1366 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1230 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1367 */ __pyx_1 = (__pyx_v_fdfnum <= 1); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; goto __pyx_L1;} + __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_3, 0, __pyx_k92p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1232 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1369 */ __pyx_1 = (__pyx_v_fdfden <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; goto __pyx_L1;} + __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_3, 0, __pyx_k93p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1234 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1371 */ __pyx_1 = (__pyx_v_fnonc < 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; goto __pyx_L1;} + __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_3, 0, __pyx_k94p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1236 */ - __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 = 1236; goto __pyx_L1;} + /* "/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; @@ -4364,151 +4272,145 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1239 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1376 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1241 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_dfnum,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1242 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_dfden,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); - Py_DECREF(((PyObject *)__pyx_v_odfden)); - __pyx_v_odfden = ((PyArrayObject *)__pyx_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1243 */ - __pyx_2 = PyArray_FROM_OTF(__pyx_v_nonc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; goto __pyx_L1;} + /* "/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_ononc)); - __pyx_v_ononc = ((PyArrayObject *)__pyx_2); + Py_DECREF(((PyObject *)__pyx_v_odfden)); + __pyx_v_odfden = ((PyArrayObject *)__pyx_2); Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1245 */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} + /* "/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; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} + + /* "/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 = PyFloat_FromDouble(1.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} + __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_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); + __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_4, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; goto __pyx_L1;} + 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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;} + __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_4, 0, __pyx_k95p); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_4); __pyx_4 = 0; __Pyx_Raise(__pyx_3, 0, 0); Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; goto __pyx_L1;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1247 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} + /* "/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_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} + __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_4, 0, ((PyObject *)__pyx_v_odfden)); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} + 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_4); __pyx_4 = 0; - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; 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 = 1247; 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 = 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_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;} + __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_2, 0, __pyx_k96p); - __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;} + 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; - 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 = 1248; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; goto __pyx_L1;} goto __pyx_L7; } __pyx_L7:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1249 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;} - __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;} + /* "/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_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; 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 = 1249; goto __pyx_L1;} - __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;} + __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_2, 0, ((PyObject *)__pyx_v_ononc)); - 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 = 1249; 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 = 1249; 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 = 1249; goto __pyx_L1;} + 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_3); __pyx_3 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;} + __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_5, 0, __pyx_k97p); - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - __Pyx_Raise(__pyx_3, 0, 0); + 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_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1251 */ - __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_odfnum,__pyx_v_odfden,__pyx_v_ononc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; goto __pyx_L1;} - __pyx_r = __pyx_2; - __pyx_2 = 0; + /* "/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); @@ -4559,32 +4461,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_odf = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1321 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1458 */ __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1322 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1459 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1323 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1460 */ __pyx_1 = (__pyx_v_fdf <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; goto __pyx_L1;} + __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_3, 0, __pyx_k98p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1325 */ - __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 = 1325; goto __pyx_L1;} + /* "/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; @@ -4592,59 +4492,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1327 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1464 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1329 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1330 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; 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 = 1330; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; 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 = 1330; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; goto __pyx_L1;} + 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 = 1330; 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 = 1330; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 1330; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1332 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -4700,52 +4598,48 @@ __pyx_v_odf = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_ononc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1355 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1492 */ __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1356 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1493 */ __pyx_v_fnonc = PyFloat_AsDouble(__pyx_v_nonc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1357 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1494 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1358 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1495 */ __pyx_1 = (__pyx_v_fdf <= 1); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; goto __pyx_L1;} + __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_3, 0, __pyx_k100p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1496; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1360 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1497 */ __pyx_1 = (__pyx_v_fnonc <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; goto __pyx_L1;} + __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_3, 0, __pyx_k101p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1362 */ - __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 = 1362; goto __pyx_L1;} + /* "/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; @@ -4753,105 +4647,101 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1365 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1502 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1367 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1368 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_nonc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1369 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} + __pyx_v_ononc = ((PyArrayObject *)__pyx_2); 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 = 1369; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1370; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1371 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} + /* "/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_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;} + 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 = 1371; 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 = 1371; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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 = 1371; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1373 */ - __pyx_3 = __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_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; goto __pyx_L1;} - __pyx_r = __pyx_3; - __pyx_3 = 0; + /* "/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); @@ -4884,7 +4774,7 @@ 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 = 1383; goto __pyx_L1;} + __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; @@ -4928,32 +4818,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_odf = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1395 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1532 */ __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1396 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1533 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1397 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1534 */ __pyx_1 = (__pyx_v_fdf <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; goto __pyx_L1;} + __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_3, 0, __pyx_k104p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1399 */ - __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 = 1399; goto __pyx_L1;} + /* "/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; @@ -4961,59 +4849,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1401 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1538 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1403 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1403; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1404 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; 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 = 1404; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; 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 = 1404; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; goto __pyx_L1;} + 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 = 1404; 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 = 1404; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 1404; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1406 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1406; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5065,35 +4951,33 @@ __pyx_v_omu = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_okappa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1488 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1625 */ __pyx_v_fmu = PyFloat_AsDouble(__pyx_v_mu); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1489 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1626 */ __pyx_v_fkappa = PyFloat_AsDouble(__pyx_v_kappa); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1490 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1627 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1491 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1628 */ __pyx_1 = (__pyx_v_fkappa < 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; goto __pyx_L1;} + __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_3, 0, __pyx_k106p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1629; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1493 */ - __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 = 1493; goto __pyx_L1;} + /* "/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; @@ -5101,66 +4985,64 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1495 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1632 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1497 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_mu,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1498 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_kappa,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1499 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} + __pyx_v_okappa = ((PyArrayObject *)__pyx_2); 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 = 1499; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1500; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1501 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5209,32 +5091,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1579 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1716 */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1580 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1717 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1581 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1718 */ __pyx_1 = (__pyx_v_fa <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; goto __pyx_L1;} + __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_3, 0, __pyx_k108p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1583 */ - __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 = 1583; goto __pyx_L1;} + /* "/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; @@ -5242,59 +5122,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1585 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1722 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1587 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1587; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1588 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; 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 = 1588; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; 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 = 1588; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; goto __pyx_L1;} + 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 = 1588; 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 = 1588; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 1588; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1590 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1590; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5341,32 +5219,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1678 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1815 */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1679 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1816 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1680 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1817 */ __pyx_1 = (__pyx_v_fa <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; goto __pyx_L1;} + __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_3, 0, __pyx_k110p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1682 */ - __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 = 1682; goto __pyx_L1;} + /* "/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; @@ -5374,59 +5250,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1684 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1821 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1686 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1687 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; 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 = 1687; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; 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 = 1687; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; goto __pyx_L1;} + 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 = 1687; 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 = 1687; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 1687; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1689 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1689; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5473,32 +5347,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1701 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1838 */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1702 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1839 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1703 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1840 */ __pyx_1 = (__pyx_v_fa <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; goto __pyx_L1;} + __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_3, 0, __pyx_k112p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1841; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1705 */ - __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 = 1705; goto __pyx_L1;} + /* "/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; @@ -5506,59 +5378,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1707 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1844 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1709 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1709; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1710 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; 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 = 1710; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; 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 = 1710; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; goto __pyx_L1;} + 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 = 1710; 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 = 1710; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 1710; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1712 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5612,35 +5482,33 @@ __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1739 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1876 */ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1740 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1877 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1741 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1878 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1742 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1879 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; goto __pyx_L1;} + __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_3, 0, __pyx_k114p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1880; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1744 */ - __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 = 1744; goto __pyx_L1;} + /* "/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; @@ -5648,66 +5516,64 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1746 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1883 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1747 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1747; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1747; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1748 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; + __pyx_v_oscale = ((PyArrayObject *)__pyx_2); + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1749 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; 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 = 1749; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1750; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1751 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5736,7 +5602,7 @@ 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 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; @@ -5763,35 +5629,33 @@ __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1863 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2000 */ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1864 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2001 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1865 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2002 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1866 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2003 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; goto __pyx_L1;} + __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_3, 0, __pyx_k116p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1868 */ - __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 = 1868; goto __pyx_L1;} + /* "/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; @@ -5799,66 +5663,64 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1870 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2007 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1871 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1871; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1871; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1872 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1872; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1872; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; + __pyx_v_oscale = ((PyArrayObject *)__pyx_2); + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1873 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; 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 = 1873; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1873; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1874; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1874; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1874; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1874; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2011; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1875 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -5887,7 +5749,7 @@ 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 Logistic distribution.\n\n "; +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; @@ -5914,35 +5776,33 @@ __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1887 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2088 */ __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1888 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2089 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1889 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2090 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1890 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2091 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; goto __pyx_L1;} + __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_3, 0, __pyx_k118p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2092; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1892 */ - __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 = 1892; goto __pyx_L1;} + /* "/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; @@ -5950,66 +5810,64 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1894 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2095 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1895 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1895; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1895; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1896 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1896; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1896; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; + __pyx_v_oscale = ((PyArrayObject *)__pyx_2); + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1897 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; 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 = 1897; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 1898; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2099; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1899 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1899; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -6038,7 +5896,7 @@ 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 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 lognormal 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 pdf.\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 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; @@ -6065,35 +5923,33 @@ __pyx_v_omean = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_osigma = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2016 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2217 */ __pyx_v_fmean = PyFloat_AsDouble(__pyx_v_mean); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2017 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2218 */ __pyx_v_fsigma = PyFloat_AsDouble(__pyx_v_sigma); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2019 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2220 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2020 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2221 */ __pyx_1 = (__pyx_v_fsigma <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; goto __pyx_L1;} + __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_3, 0, __pyx_k120p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2022 */ - __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 = 2022; goto __pyx_L1;} + /* "/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; @@ -6101,66 +5957,64 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2024 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2225 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2026 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_mean,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2027 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_sigma,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2027; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2027; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; + __pyx_v_osigma = ((PyArrayObject *)__pyx_2); + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2028 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; 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 = 2028; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 2029; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2230; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2030 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -6210,32 +6064,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2042 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2243 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2044 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2245 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2045 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2246 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; goto __pyx_L1;} + __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_3, 0, __pyx_k122p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2247; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2047 */ - __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 = 2047; goto __pyx_L1;} + /* "/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; @@ -6243,59 +6095,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2049 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2250 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2051 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2052 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; 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 = 2052; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; 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 = 2052; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; goto __pyx_L1;} + 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 = 2052; 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 = 2052; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 2052; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2054 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2054; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -6351,52 +6201,48 @@ __pyx_v_omean = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2066 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2267 */ __pyx_v_fmean = PyFloat_AsDouble(__pyx_v_mean); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2067 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2268 */ __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2068 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2269 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2069 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2270 */ __pyx_1 = (__pyx_v_fmean <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2070; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2070; goto __pyx_L1;} + __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_3, 0, __pyx_k124p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2070; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2070; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2071 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2272 */ __pyx_1 = (__pyx_v_fscale <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; goto __pyx_L1;} + __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_3, 0, __pyx_k125p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2073 */ - __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 = 2073; goto __pyx_L1;} + /* "/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; @@ -6404,102 +6250,98 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2075 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2276 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2076 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_mean,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2076; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2076; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2077 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2077; goto __pyx_L1;} - if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2077; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; + __pyx_v_oscale = ((PyArrayObject *)__pyx_2); + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2078 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; 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 = 2078; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 2079; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; goto __pyx_L1;} goto __pyx_L5; } - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} + __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_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; goto __pyx_L1;} + 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 = 2080; 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 = 2080; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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 = 2080; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2081; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2081; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2081; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2081; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2082 */ - __pyx_3 = __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_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2082; goto __pyx_L1;} - __pyx_r = __pyx_3; - __pyx_3 = 0; + /* "/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); @@ -6569,72 +6411,66 @@ __pyx_v_omode = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_oright = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2097 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2298 */ __pyx_v_fleft = PyFloat_AsDouble(__pyx_v_left); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2098 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2299 */ __pyx_v_fright = PyFloat_AsDouble(__pyx_v_right); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2099 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2300 */ __pyx_v_fmode = PyFloat_AsDouble(__pyx_v_mode); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2100 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2301 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2101 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; goto __pyx_L1;} + __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_3, 0, __pyx_k128p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2103 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2104; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2104; goto __pyx_L1;} + __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_3, 0, __pyx_k129p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2104; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2104; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2105 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; goto __pyx_L1;} + __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_3, 0, __pyx_k130p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2107 */ - __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 = 2107; goto __pyx_L1;} + /* "/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; @@ -6642,146 +6478,140 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2110 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2311 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2111 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_left,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2111; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2112 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_mode,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2112; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); - Py_DECREF(((PyObject *)__pyx_v_omode)); - __pyx_v_omode = ((PyArrayObject *)__pyx_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2113 */ - __pyx_2 = PyArray_FROM_OTF(__pyx_v_right,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2113; goto __pyx_L1;} + /* "/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_oright)); - __pyx_v_oright = ((PyArrayObject *)__pyx_2); + Py_DECREF(((PyObject *)__pyx_v_omode)); + __pyx_v_omode = ((PyArrayObject *)__pyx_2); Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2115 */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} + /* "/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; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} + + /* "/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 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} + __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_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5); + __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_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2115; goto __pyx_L1;} + 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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2116; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2116; goto __pyx_L1;} + __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_4, 0, __pyx_k131p); - __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2116; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_4); __pyx_4 = 0; __Pyx_Raise(__pyx_3, 0, 0); Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2116; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; goto __pyx_L1;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2117 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; goto __pyx_L1;} - __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; 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 = 2117; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_4, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; goto __pyx_L1;} + /* "/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_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; goto __pyx_L1;} + __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_2, 0, ((PyObject *)__pyx_v_omode)); + PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_omode)); Py_INCREF(((PyObject *)__pyx_v_oright)); - PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_oright)); - __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; goto __pyx_L1;} + 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; - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; 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 = 2117; 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 = 2117; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; goto __pyx_L1;} + __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_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2119 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; 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 = 2119; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} + /* "/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_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} + __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_2, 0, ((PyObject *)__pyx_v_oleft)); + PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_oleft)); Py_INCREF(((PyObject *)__pyx_v_oright)); - PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_oright)); - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + 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; - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5); + 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_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} + __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_3); __pyx_3 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; goto __pyx_L1;} 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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; goto __pyx_L1;} + __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_4, 0, __pyx_k133p); - __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; goto __pyx_L1;} + 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_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2321; goto __pyx_L1;} goto __pyx_L8; } __pyx_L8:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2121 */ - __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 = 2121; goto __pyx_L1;} + /* "/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; @@ -6822,7 +6652,7 @@ 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 Binomial distribution of n trials and p probability of success.\n\n "; +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; @@ -6847,66 +6677,60 @@ __pyx_v_on = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2136 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2411 */ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2137 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2412 */ __pyx_v_ln = PyInt_AsLong(__pyx_v_n); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2138 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2413 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2139 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2414 */ __pyx_1 = (__pyx_v_ln <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; goto __pyx_L1;} + __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_3, 0, __pyx_k134p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2141 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2416 */ __pyx_1 = (__pyx_v_fp < 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2142; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2142; goto __pyx_L1;} + __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_3, 0, __pyx_k135p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2142; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2142; goto __pyx_L1;} + {__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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2144; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2144; goto __pyx_L1;} + __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_3, 0, __pyx_k136p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2144; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2144; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2145 */ - __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 = 2145; goto __pyx_L1;} + /* "/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; @@ -6914,144 +6738,138 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2147 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2422 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2149 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_n,NPY_LONG,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2149; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2150 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2151 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} + __pyx_v_op = ((PyArrayObject *)__pyx_2); 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 = 2151; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 2152; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2427; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2153 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} + /* "/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_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; goto __pyx_L1;} + 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 = 2153; 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 = 2153; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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 = 2153; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2155 */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} - __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; 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 = 2155; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_greater); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} + /* "/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_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} + __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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3); - __pyx_3 = 0; - __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} + __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; - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; goto __pyx_L1;} + __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_5, 0, __pyx_k139p); - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - __Pyx_Raise(__pyx_2, 0, 0); + 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_filename = __pyx_f[0]; __pyx_lineno = 2156; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2157 */ - __pyx_4 = __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_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2157; goto __pyx_L1;} - __pyx_r = __pyx_4; - __pyx_4 = 0; + /* "/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); @@ -7113,66 +6931,60 @@ __pyx_v_on = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2171 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2446 */ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2172 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2447 */ __pyx_v_fn = PyFloat_AsDouble(__pyx_v_n); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2173 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2448 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2174 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2449 */ __pyx_1 = (__pyx_v_fn <= 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; goto __pyx_L1;} + __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_3, 0, __pyx_k140p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2450; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2176 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2451 */ __pyx_1 = (__pyx_v_fp < 0); if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; goto __pyx_L1;} + __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_3, 0, __pyx_k141p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; goto __pyx_L1;} + {__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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; goto __pyx_L1;} + __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_3, 0, __pyx_k142p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2454; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2180 */ - __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 = 2180; goto __pyx_L1;} + /* "/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; @@ -7180,144 +6992,138 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2183 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2458 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2185 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_n,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2186 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2187 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} + __pyx_v_op = ((PyArrayObject *)__pyx_2); 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 = 2187; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} + + /* "/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_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 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; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; goto __pyx_L1;} + 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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2188; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2188; goto __pyx_L1;} + __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(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2188; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 2188; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2463; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2189 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} + /* "/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_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2189; goto __pyx_L1;} + 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 = 2189; 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 = 2189; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 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 = 2189; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2190; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2190; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2190; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2190; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2191 */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} - __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; 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 = 2191; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_greater); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} + /* "/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_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} + __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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + 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_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3); - __pyx_3 = 0; - __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} + __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; - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2191; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; goto __pyx_L1;} + __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_5, 0, __pyx_k145p); - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - __Pyx_Raise(__pyx_2, 0, 0); + 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_filename = __pyx_f[0]; __pyx_lineno = 2192; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2193 */ - __pyx_4 = __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_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2193; goto __pyx_L1;} - __pyx_r = __pyx_4; - __pyx_4 = 0; + /* "/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); @@ -7367,35 +7173,33 @@ Py_INCREF(__pyx_v_size); __pyx_v_olam = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2205 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2480 */ __pyx_v_flam = PyFloat_AsDouble(__pyx_v_lam); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2206 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2481 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2207 */ - __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2207; goto __pyx_L1;} - if (PyObject_Cmp(__pyx_v_lam, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2207; goto __pyx_L1;} + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; goto __pyx_L1;} + __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_3, 0, __pyx_k146p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2209 */ - __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 = 2209; goto __pyx_L1;} + /* "/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; @@ -7403,59 +7207,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2211 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2486 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2213 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_lam,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2213; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2214 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; 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 = 2214; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; 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 = 2214; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2214; goto __pyx_L1;} + 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 = 2214; 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 = 2214; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 2214; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2216 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2216; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -7502,32 +7304,30 @@ Py_INCREF(__pyx_v_size); __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2297 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2572 */ __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2298 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2573 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2299 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; goto __pyx_L1;} + __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_3, 0, __pyx_k148p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2575; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2301 */ - __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 = 2301; goto __pyx_L1;} + /* "/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; @@ -7535,59 +7335,57 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2303 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2578 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2305 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2306 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; 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 = 2306; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyFloat_FromDouble(1.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; goto __pyx_L1;} + 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 = 2306; 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 = 2306; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 2306; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2307; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2308 */ - __pyx_5 = __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_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; goto __pyx_L1;} - __pyx_r = __pyx_5; - __pyx_5 = 0; + /* "/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); @@ -7638,49 +7436,45 @@ Py_INCREF(__pyx_v_size); __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2358 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2633 */ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2359 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2634 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2360 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; goto __pyx_L1;} + __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_3, 0, __pyx_k150p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2362 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; goto __pyx_L1;} + __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_3, 0, __pyx_k151p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2364 */ - __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 = 2364; goto __pyx_L1;} + /* "/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; @@ -7688,98 +7482,94 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2366 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2641 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2369 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2369; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2370 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; 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 = 2370; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; 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 = 2370; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2370; goto __pyx_L1;} + 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 = 2370; 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 = 2370; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 2370; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2372 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; 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 = 2372; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_greater); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; goto __pyx_L1;} + /* "/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_5 = PyFloat_FromDouble(1.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; goto __pyx_L1;} - __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + 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_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; 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 = 2372; goto __pyx_L1;} + __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; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; goto __pyx_L1;} + __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_3, 0, __pyx_k153p); - __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __Pyx_Raise(__pyx_4, 0, 0); + 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_filename = __pyx_f[0]; __pyx_lineno = 2373; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2374 */ - __pyx_2 = __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_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2374; goto __pyx_L1;} - __pyx_r = __pyx_2; - __pyx_2 = 0; + /* "/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); @@ -7820,7 +7610,7 @@ 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 Hypergeometric distribution.\n\n Consider an urn with ngood \"good\" balls and nbad \"bad\" balls. If one\n were to draw nsample balls from the urn without replacement, then\n the hypergeometric distribution describes the distribution of \"good\"\n balls in the sample.\n\n "; +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; @@ -7851,302 +7641,286 @@ __pyx_v_onbad = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_v_onsample = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2391 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2738 */ __pyx_v_lngood = PyInt_AsLong(__pyx_v_ngood); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2392 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2739 */ __pyx_v_lnbad = PyInt_AsLong(__pyx_v_nbad); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2393 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2740 */ __pyx_v_lnsample = PyInt_AsLong(__pyx_v_nsample); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2394 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2741 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2395 */ - __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; goto __pyx_L1;} - if (PyObject_Cmp(__pyx_v_ngood, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; goto __pyx_L1;} + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; goto __pyx_L1;} + __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_3, 0, __pyx_k154p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2743; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2397 */ - __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2397; goto __pyx_L1;} - if (PyObject_Cmp(__pyx_v_nbad, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2397; goto __pyx_L1;} + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2398; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2398; goto __pyx_L1;} + __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_4, 0, __pyx_k155p); - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2398; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_4); __pyx_4 = 0; __Pyx_Raise(__pyx_2, 0, 0); Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2398; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2745; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2399 */ - __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2399; goto __pyx_L1;} - if (PyObject_Cmp(__pyx_v_nsample, __pyx_3, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2399; goto __pyx_L1;} + /* "/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_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2400; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2400; goto __pyx_L1;} + __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(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2400; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __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 = 2400; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2747; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2401 */ - __pyx_4 = PyNumber_Add(__pyx_v_ngood, __pyx_v_nbad); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; goto __pyx_L1;} - if (PyObject_Cmp(__pyx_4, __pyx_v_nsample, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; goto __pyx_L1;} + /* "/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_4); __pyx_4 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_1) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2402; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2403 */ - __pyx_2 = __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_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2403; goto __pyx_L1;} - __pyx_r = __pyx_2; - __pyx_2 = 0; + /* "/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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2407 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2754 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2409 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_ngood,NPY_LONG,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3))); + /* "/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_3); - Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_v_ongood = ((PyArrayObject *)__pyx_2); + Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2410 */ - __pyx_4 = PyArray_FROM_OTF(__pyx_v_nbad,NPY_LONG,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2410; goto __pyx_L1;} - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4))); + /* "/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_4); - Py_DECREF(__pyx_4); __pyx_4 = 0; + __pyx_v_onbad = ((PyArrayObject *)__pyx_3); + Py_DECREF(__pyx_3); __pyx_3 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2411 */ - __pyx_2 = PyArray_FROM_OTF(__pyx_v_nsample,NPY_LONG,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2411; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2412 */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} + /* "/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_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} + __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_2); - __pyx_2 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + 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_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); - __pyx_2 = 0; - __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} + __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; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; goto __pyx_L1;} + __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_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; goto __pyx_L1;} + __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_4, 0, __pyx_k158p); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __Pyx_Raise(__pyx_3, 0, 0); + 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_filename = __pyx_f[0]; __pyx_lineno = 2413; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2414 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_4, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} + /* "/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_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} + __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_4, 0, ((PyObject *)__pyx_v_onbad)); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; 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 = 2414; goto __pyx_L1;} + __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; - __pyx_1 = PyObject_IsTrue(__pyx_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; if (__pyx_1) { - __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; goto __pyx_L1;} + __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_2, 0, __pyx_k159p); - __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; goto __pyx_L1;} + 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; - 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;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; goto __pyx_L1;} goto __pyx_L8; } __pyx_L8:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2416 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; goto __pyx_L1;} - __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; 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 = 2416; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; goto __pyx_L1;} + /* "/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 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; goto __pyx_L1;} - __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; goto __pyx_L1;} + __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_2, 0, ((PyObject *)__pyx_v_onsample)); - 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 = 2416; 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 = 2416; 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 = 2416; goto __pyx_L1;} + 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; - __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; 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 = 2763; goto __pyx_L1;} + Py_DECREF(__pyx_4); __pyx_4 = 0; if (__pyx_1) { - __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2417; goto __pyx_L1;} - __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2417; goto __pyx_L1;} + __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_5, 0, __pyx_k160p); - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2417; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; + 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 = 2417; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; goto __pyx_L1;} goto __pyx_L9; } __pyx_L9:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2418 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; 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 = 2418; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} + /* "/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 = 2418; goto __pyx_L1;} - __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} + __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_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} + __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_2, 0, ((PyObject *)__pyx_v_ongood)); + PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_ongood)); Py_INCREF(((PyObject *)__pyx_v_onbad)); - PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_onbad)); - __pyx_6 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + 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; - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_5, 0, __pyx_6); + 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_5, 1, ((PyObject *)__pyx_v_onsample)); + PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_onsample)); __pyx_6 = 0; - __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} + __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_5); __pyx_5 = 0; - __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_6, 0, __pyx_2); - __pyx_2 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; goto __pyx_L1;} + 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 = 2418; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2420 */ - __pyx_6 = __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_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2420; goto __pyx_L1;} - __pyx_r = __pyx_6; - __pyx_6 = 0; + /* "/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); @@ -8184,7 +7958,7 @@ 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 Logarithmic series distribution.\n\n "; +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; @@ -8204,49 +7978,45 @@ Py_INCREF(__pyx_v_size); __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2433 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2847 */ __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2434 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2848 */ __pyx_1 = (!PyErr_Occurred()); if (__pyx_1) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2435 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; goto __pyx_L1;} + __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_3, 0, __pyx_k162p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2437 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2438; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2438; goto __pyx_L1;} + __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_3, 0, __pyx_k163p); - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2438; goto __pyx_L1;} + 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_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2438; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2439 */ - __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 = 2439; goto __pyx_L1;} + /* "/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; @@ -8254,98 +8024,94 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2441 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2855 */ PyErr_Clear(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2443 */ - __pyx_3 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2444 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; 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 = 2444; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; 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 = 2444; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; goto __pyx_L1;} + /* "/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_3); - __pyx_3 = 0; - __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2444; goto __pyx_L1;} + 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 = 2444; 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 = 2444; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 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 = 2444; goto __pyx_L1;} + __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_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; goto __pyx_L1;} + __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_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2445; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2446 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; 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 = 2446; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_greater_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; goto __pyx_L1;} + /* "/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_5 = PyFloat_FromDouble(1.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; goto __pyx_L1;} - __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; goto __pyx_L1;} + __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_5); - __pyx_5 = 0; - __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + 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_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; 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 = 2446; goto __pyx_L1;} + __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; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; goto __pyx_L1;} + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; goto __pyx_L1;} + __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_3, 0, __pyx_k165p); - __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __Pyx_Raise(__pyx_4, 0, 0); + 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_filename = __pyx_f[0]; __pyx_lineno = 2447; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2448 */ - __pyx_2 = __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_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2448; goto __pyx_L1;} - __pyx_r = __pyx_2; - __pyx_2 = 0; + /* "/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); @@ -8367,14 +8133,12 @@ static PyObject *__pyx_n_array; static PyObject *__pyx_n_shape; -static PyObject *__pyx_n_list; static PyObject *__pyx_n_append; static PyObject *__pyx_n_multiply; static PyObject *__pyx_n_reduce; static PyObject *__pyx_n_svd; static PyObject *__pyx_n_dot; static PyObject *__pyx_n_sqrt; -static PyObject *__pyx_n_tuple; static PyObject *__pyx_k166p; static PyObject *__pyx_k167p; @@ -8421,38 +8185,38 @@ __pyx_v_s = Py_None; Py_INCREF(Py_None); __pyx_v_v = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2544 */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; goto __pyx_L1;} + /* "/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 = 2544; goto __pyx_L1;} + __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 = 2544; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2545 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; goto __pyx_L1;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; goto __pyx_L1;} + /* "/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 = 2545; goto __pyx_L1;} + __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 = 2545; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2546 */ + /* "/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 = 2547; goto __pyx_L1;} + __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; @@ -8465,98 +8229,82 @@ } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2550 */ - __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; goto __pyx_L1;} - __pyx_5 = PyObject_Length(__pyx_3); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; goto __pyx_L1;} + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; goto __pyx_L1;} - __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; goto __pyx_L1;} + __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_1, 0, __pyx_k166p); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; goto __pyx_L1;} + 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_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; goto __pyx_L1;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2552 */ - __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - __pyx_5 = PyObject_Length(__pyx_2); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + /* "/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_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __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; - __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - __pyx_6 = PyObject_GetItem(__pyx_1, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - if (PyObject_Cmp(__pyx_2, __pyx_6, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_6); __pyx_6 = 0; } if (__pyx_4) { - __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; goto __pyx_L1;} + __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_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __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_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; goto __pyx_L1;} + __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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2554 */ - __pyx_6 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} - __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} - __pyx_3 = PyObject_GetItem(__pyx_6, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} - __pyx_6 = PyInt_FromLong(0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} - __pyx_1 = PyObject_GetItem(__pyx_2, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} + /* "/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; - Py_DECREF(__pyx_6); __pyx_6 = 0; - if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; goto __pyx_L1;} + __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_1); __pyx_1 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_4) { - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; goto __pyx_L1;} - __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; goto __pyx_L1;} + __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_6, 0, __pyx_k168p); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_6); __pyx_6 = 0; + 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 = 2555; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2969; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2557 */ - __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; goto __pyx_L1;} - __pyx_4 = PyObject_IsInstance(__pyx_v_shape,__pyx_1); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2557; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + /* "/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 = 2558; goto __pyx_L1;} + __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); @@ -8566,174 +8314,166 @@ } __pyx_L6:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2559 */ - __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; goto __pyx_L1;} - __pyx_3 = PySequence_GetSlice(__pyx_v_shape, 0, PY_SSIZE_T_MAX); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; goto __pyx_L1;} - __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3); - __pyx_3 = 0; - __pyx_2 = PyObject_CallObject(__pyx_6, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; goto __pyx_L1;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2560 */ - __pyx_3 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; goto __pyx_L1;} - __pyx_6 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; goto __pyx_L1;} - __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_6, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; goto __pyx_L1;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; 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 = 2560; goto __pyx_L1;} + /* "/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; - Py_DECREF(__pyx_6); __pyx_6 = 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2564 */ - __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} - __pyx_6 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} + /* "/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_1 = PyObject_GetAttr(__pyx_6, __pyx_n_reduce); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} + __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_3, 0, __pyx_v_final_shape); - __pyx_6 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + 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; - __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_6); - __pyx_6 = 0; - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; 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 = 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_3; - __pyx_3 = 0; + __pyx_v_x = __pyx_2; + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2565 */ - __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_6, __pyx_n_multiply); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} + /* "/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_1 = PyObject_GetAttr(__pyx_2, __pyx_n_reduce); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_5 = PyObject_Length(__pyx_v_final_shape); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} - __pyx_3 = PySequence_GetSlice(__pyx_v_final_shape, 0, (__pyx_5 - 1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} - __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_6, 0, __pyx_3); - __pyx_3 = 0; - __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} + __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; - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; goto __pyx_L1;} - __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; goto __pyx_L1;} - __pyx_6 = PyObject_GetItem(__pyx_3, __pyx_1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_6); + __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_6 = 0; - if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2574 */ - __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; goto __pyx_L1;} + /* "/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_1, 0, __pyx_n_svd); - __pyx_2 = __Pyx_Import(__pyx_k169p, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_6 = PyObject_GetAttr(__pyx_2, __pyx_n_svd); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; goto __pyx_L1;} - Py_DECREF(__pyx_v_svd); - __pyx_v_svd = __pyx_6; - __pyx_6 = 0; + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2576 */ - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} + /* "/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_3, 0, __pyx_v_cov); - __pyx_1 = PyObject_CallObject(__pyx_v_svd, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_2 = PyObject_GetIter(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_6 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} + 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_6; - __pyx_6 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} - Py_DECREF(__pyx_v_s); - __pyx_v_s = __pyx_3; + __pyx_v_u = __pyx_3; __pyx_3 = 0; - __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} + __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_1; - __pyx_1 = 0; - if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2577 */ - __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_6, __pyx_n_dot); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_sqrt); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} + __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; - __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} - Py_INCREF(__pyx_v_s); - PyTuple_SET_ITEM(__pyx_6, 0, __pyx_v_s); - __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} + + /* "/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; - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_2 = PyNumber_Multiply(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} + __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; - __pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_6, 0, __pyx_2); - Py_INCREF(__pyx_v_v); - PyTuple_SET_ITEM(__pyx_6, 1, __pyx_v_v); - __pyx_2 = 0; - __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; goto __pyx_L1;} 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_1; - __pyx_1 = 0; + __pyx_v_x = __pyx_2; + __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2580 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_6 = PyTuple_New(3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; goto __pyx_L1;} + /* "/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_6, 0, __pyx_v_mean); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_mean); Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_6, 1, __pyx_v_x); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_x); Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_6, 2, __pyx_v_x); - __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + 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_1); __pyx_1 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2581 */ - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;} + /* "/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_3, 0, __pyx_v_final_shape); - __pyx_6 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2581; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2582 */ + /* "/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; @@ -8803,42 +8543,40 @@ __pyx_v_shape = Py_None; Py_INCREF(Py_None); __pyx_v_multin = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2643 */ - __pyx_1 = PyObject_Length(__pyx_v_pvals); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2643; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2644 */ - __pyx_2 = PyArray_ContiguousFromObject(__pyx_v_pvals,NPY_DOUBLE,1,1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2644; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2645 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3059 */ __pyx_v_pix = ((double *)arrayObject_parr->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2647 */ + /* "/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 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; goto __pyx_L1;} + __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_4, 0, __pyx_k171p); - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; goto __pyx_L1;} + 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_Raise(__pyx_5, 0, 0); - Py_DECREF(__pyx_5); __pyx_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; goto __pyx_L1;} goto __pyx_L2; } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2650 */ + /* "/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 = 2651; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2651; goto __pyx_L1;} + __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); @@ -8846,20 +8584,16 @@ __pyx_4 = 0; goto __pyx_L3; } - __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; goto __pyx_L1;} + __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(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + __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_5 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; goto __pyx_L1;} - __pyx_3 = __pyx_4 == __pyx_5; + __pyx_3 = __pyx_4 == ((PyObject *)(&PyInt_Type)); Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; if (__pyx_3) { - __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; goto __pyx_L1;} - __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; goto __pyx_L1;} + __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); @@ -8870,68 +8604,67 @@ goto __pyx_L3; } /*else*/ { - __pyx_5 = PyInt_FromLong(__pyx_v_d); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2655; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2655; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5); - __pyx_5 = 0; - __pyx_4 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2655; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __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_4; - __pyx_4 = 0; + __pyx_v_shape = __pyx_2; + __pyx_2 = 0; } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2657 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; goto __pyx_L1;} + /* "/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_5, 0, __pyx_v_shape); - PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4); - __pyx_4 = 0; - __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; goto __pyx_L1;} + 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_5); __pyx_5 = 0; + Py_DECREF(__pyx_4); __pyx_4 = 0; Py_DECREF(__pyx_v_multin); - __pyx_v_multin = __pyx_4; - __pyx_4 = 0; + __pyx_v_multin = __pyx_5; + __pyx_5 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2658 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2659 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3073 */ __pyx_v_mnix = ((long *)arrayObject_mnarr->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2660 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3074 */ __pyx_v_i = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2661 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2662 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3076 */ __pyx_v_Sum = 1.0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2663 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3077 */ __pyx_v_dn = __pyx_v_n; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2664 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2665 */ + /* "/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)); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2666 */ + /* "/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)])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2667 */ + /* "/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; @@ -8939,12 +8672,12 @@ } __pyx_L8:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2669 */ + /* "/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:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2670 */ + /* "/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; @@ -8952,11 +8685,11 @@ } __pyx_L9:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2673 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3087 */ __pyx_v_i = (__pyx_v_i + __pyx_v_d); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2675 */ + /* "/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; @@ -9014,25 +8747,25 @@ __pyx_v_shape = Py_None; Py_INCREF(Py_None); __pyx_v_diric = Py_None; Py_INCREF(Py_None); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2741 */ - __pyx_1 = PyObject_Length(__pyx_v_alpha); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2742 */ - __pyx_2 = PyArray_ContiguousFromObject(__pyx_v_alpha,NPY_DOUBLE,1,1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2743 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3157 */ __pyx_v_alpha_data = ((double *)__pyx_v_alpha_arr->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2745 */ + /* "/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 = 2746; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2746; goto __pyx_L1;} + __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); @@ -9040,106 +8773,102 @@ __pyx_4 = 0; goto __pyx_L2; } - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2747; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2747; goto __pyx_L1;} + __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_4, 0, __pyx_v_size); - __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2747; goto __pyx_L1;} + 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; - __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2747; goto __pyx_L1;} - __pyx_3 = __pyx_5 == __pyx_2; - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_3) { - __pyx_4 = PyInt_FromLong(__pyx_v_k); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; goto __pyx_L1;} - __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; goto __pyx_L1;} + __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_5, 0, __pyx_v_size); - PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4); - __pyx_4 = 0; + 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_5; - __pyx_5 = 0; + __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 = 2750; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2750; goto __pyx_L1;} + __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_5 = PyNumber_Add(__pyx_v_size, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2750; goto __pyx_L1;} + __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_5; - __pyx_5 = 0; + __pyx_v_shape = __pyx_2; + __pyx_2 = 0; } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2752 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; goto __pyx_L1;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_zeros); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; 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 = 2752; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_n_float64); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; 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 = 2752; goto __pyx_L1;} + /* "/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_5, 0, __pyx_v_shape); - 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 = 2752; goto __pyx_L1;} + 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_5); __pyx_5 = 0; Py_DECREF(__pyx_v_diric); - __pyx_v_diric = __pyx_2; - __pyx_2 = 0; + __pyx_v_diric = __pyx_5; + __pyx_5 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2753 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2754 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3168 */ __pyx_v_val_data = ((double *)__pyx_v_val_arr->data); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2756 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3170 */ __pyx_v_i = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2757 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3171 */ __pyx_v_totsize = PyArray_SIZE(__pyx_v_val_arr); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2758 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2759 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3173 */ __pyx_v_acc = 0.0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2760 */ + /* "/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) { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2761 */ + /* "/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])); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2762 */ + /* "/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)])); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2763 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3177 */ __pyx_v_invacc = (1 / __pyx_v_acc); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2764 */ + /* "/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); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2766 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3180 */ __pyx_v_i = (__pyx_v_i + __pyx_v_k); } - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2768 */ + /* "/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; @@ -9184,28 +8913,25 @@ Py_INCREF(__pyx_v_self); Py_INCREF(__pyx_v_x); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2781 */ - __pyx_1 = PyObject_Length(__pyx_v_x); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2781; goto __pyx_L1;} + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2782 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3196 */ /*try:*/ { - __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; goto __pyx_L2;} - __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; goto __pyx_L2;} + __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_1 = PyObject_Length(__pyx_3); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; goto __pyx_L2;} - Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_v_j = __pyx_1; } goto __pyx_L3; __pyx_L2:; Py_XDECREF(__pyx_2); __pyx_2 = 0; - Py_XDECREF(__pyx_3); __pyx_3 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2784 */ + /* "/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 = 2784; goto __pyx_L1;} + 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; @@ -9214,82 +8940,64 @@ } __pyx_L3:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2787 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2790 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2791 */ - __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} - __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} + /* "/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; - __pyx_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} - if (PyObject_SetItem(__pyx_v_x, __pyx_4, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; 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 = 3205; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} - if (PyObject_SetItem(__pyx_v_x, __pyx_3, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2792 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3206 */ __pyx_v_i = (__pyx_v_i - 1); } goto __pyx_L4; } /*else*/ { - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2795 */ - __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; goto __pyx_L1;} + /* "/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_5 = PyObject_HasAttr(__pyx_2,__pyx_n_copy); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_v_copy = __pyx_5; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2796 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2798 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2799 */ - __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - __pyx_4 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} + /* "/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 = PyObject_GetAttr(__pyx_4, __pyx_n_copy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} + __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_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} + __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; - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_copy); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} + 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; - __pyx_2 = PyObject_CallObject(__pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - if (PyObject_SetItem(__pyx_v_x, __pyx_4, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - if (PyObject_SetItem(__pyx_v_x, __pyx_3, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2800 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3214 */ __pyx_v_i = (__pyx_v_i - 1); } goto __pyx_L7; @@ -9299,30 +9007,22 @@ __pyx_5 = (__pyx_v_i > 0); if (!__pyx_5) break; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2803 */ + /* "/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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2804 */ - __pyx_4 = PyInt_FromLong(__pyx_v_j); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_3 = PySequence_GetSlice(__pyx_2, 0, PY_SSIZE_T_MAX); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} + /* "/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; - __pyx_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} + 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; - __pyx_4 = PySequence_GetSlice(__pyx_2, 0, PY_SSIZE_T_MAX); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; 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 = 3218; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - if (PyObject_SetItem(__pyx_v_x, __pyx_3, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2805 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3219 */ __pyx_v_i = (__pyx_v_i - 1); } } @@ -9354,68 +9054,67 @@ PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - int __pyx_4; + 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); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2834 */ - __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; goto __pyx_L1;} - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_integer); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; 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 = 2834; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_3); - __pyx_1 = 0; - __pyx_3 = 0; - __pyx_4 = PyObject_IsInstance(__pyx_v_x,__pyx_2); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (__pyx_4) { - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; goto __pyx_L1;} - __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_arange); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; goto __pyx_L1;} + /* "/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_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2835; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __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_1; - __pyx_1 = 0; + __pyx_v_arr = __pyx_4; + __pyx_4 = 0; goto __pyx_L2; } /*else*/ { - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; goto __pyx_L1;} + __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_1, 0, __pyx_v_x); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; goto __pyx_L1;} + 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_1); __pyx_1 = 0; + Py_DECREF(__pyx_4); __pyx_4 = 0; Py_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_3; - __pyx_3 = 0; + __pyx_v_arr = __pyx_1; + __pyx_1 = 0; } __pyx_L2:; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2838 */ - __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2838; goto __pyx_L1;} - __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2838; goto __pyx_L1;} + /* "/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_1, 0, __pyx_v_arr); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2838; goto __pyx_L1;} + 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; - Py_DECREF(__pyx_3); __pyx_3 = 0; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2839 */ + /* "/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; @@ -9425,7 +9124,7 @@ __pyx_L1:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); __Pyx_AddTraceback("mtrand.RandomState.permutation"); __pyx_r = 0; __pyx_L0:; @@ -9437,8 +9136,6 @@ static __Pyx_InternTabEntry __pyx_intern_tab[] = { {&__pyx_n_MT19937, "MT19937"}, - {&__pyx_n_TypeError, "TypeError"}, - {&__pyx_n_ValueError, "ValueError"}, {&__pyx_n___RandomState_ctor, "__RandomState_ctor"}, {&__pyx_n__rand, "_rand"}, {&__pyx_n_add, "add"}, @@ -9466,12 +9163,10 @@ {&__pyx_n_greater_equal, "greater_equal"}, {&__pyx_n_gumbel, "gumbel"}, {&__pyx_n_hypergeometric, "hypergeometric"}, - {&__pyx_n_int, "int"}, {&__pyx_n_integer, "integer"}, {&__pyx_n_laplace, "laplace"}, {&__pyx_n_less, "less"}, {&__pyx_n_less_equal, "less_equal"}, - {&__pyx_n_list, "list"}, {&__pyx_n_logistic, "logistic"}, {&__pyx_n_lognormal, "lognormal"}, {&__pyx_n_logseries, "logseries"}, @@ -9510,8 +9205,6 @@ {&__pyx_n_subtract, "subtract"}, {&__pyx_n_svd, "svd"}, {&__pyx_n_triangular, "triangular"}, - {&__pyx_n_tuple, "tuple"}, - {&__pyx_n_type, "type"}, {&__pyx_n_uint, "uint"}, {&__pyx_n_uint32, "uint32"}, {&__pyx_n_uniform, "uniform"}, @@ -9653,14 +9346,6 @@ (*o->ob_type->tp_free)(o); } -static int __pyx_tp_traverse_6mtrand_RandomState(PyObject *o, visitproc v, void *a) { - return 0; -} - -static int __pyx_tp_clear_6mtrand_RandomState(PyObject *o) { - return 0; -} - static struct PyMethodDef __pyx_methods_6mtrand_RandomState[] = { {"seed", (PyCFunction)__pyx_f_6mtrand_11RandomState_seed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_seed}, {"get_state", (PyCFunction)__pyx_f_6mtrand_11RandomState_get_state, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_get_state}, @@ -9806,10 +9491,10 @@ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_RandomState, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*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 : {None, int, array-like}\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*/ - __pyx_tp_traverse_6mtrand_RandomState, /*tp_traverse*/ - __pyx_tp_clear_6mtrand_RandomState, /*tp_clear*/ + 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*/ @@ -9877,37 +9562,37 @@ 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":121 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":121 */ import_array(); - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":123 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":546 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":546 */ Py_INCREF(Py_None); __pyx_k2 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":556 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":556 */ Py_INCREF(Py_None); __pyx_k3 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":646 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":646 */ Py_INCREF(Py_None); __pyx_k4 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":655 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":655 */ Py_INCREF(Py_None); __pyx_k5 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":683 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":747 */ + /* "/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; @@ -9917,17 +9602,17 @@ Py_INCREF(Py_None); __pyx_k10 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":895 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":910 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":910 */ Py_INCREF(Py_None); __pyx_k13 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":919 */ + /* "/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; @@ -9937,495 +9622,495 @@ Py_INCREF(Py_None); __pyx_k16 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1019 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1019 */ Py_INCREF(Py_None); __pyx_k17 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1078 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1128 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1128 */ Py_INCREF(Py_None); __pyx_k20 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1137 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1137 */ Py_INCREF(Py_None); __pyx_k21 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1159 */ + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1187 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1250 */ Py_INCREF(Py_None); __pyx_k24 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1216 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1353 */ Py_INCREF(Py_None); __pyx_k25 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1254 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1391 */ Py_INCREF(Py_None); __pyx_k26 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1334 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1471 */ Py_INCREF(Py_None); __pyx_k27 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1376 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1513 */ Py_INCREF(Py_None); __pyx_k28 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1385 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1522 */ Py_INCREF(Py_None); __pyx_k29 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1408 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1545 */ Py_INCREF(Py_None); __pyx_k30 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1503 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1640 */ Py_INCREF(Py_None); __pyx_k31 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1592 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1729 */ Py_INCREF(Py_None); __pyx_k32 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1691 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":1828 */ Py_INCREF(Py_None); __pyx_k33 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1714 */ - __pyx_7 = PyFloat_FromDouble(0.0); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; goto __pyx_L1;} + /* "/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 = 1714; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1753 */ - __pyx_9 = PyFloat_FromDouble(0.0); if (!__pyx_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; goto __pyx_L1;} + /* "/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 = 1753; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1877 */ - __pyx_11 = PyFloat_FromDouble(0.0); if (!__pyx_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1877; goto __pyx_L1;} + /* "/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 = 1877; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":1901 */ - __pyx_13 = PyFloat_FromDouble(0.0); if (!__pyx_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1901; goto __pyx_L1;} + /* "/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 = 1901; goto __pyx_L1;} + __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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2032 */ - __pyx_15 = PyFloat_FromDouble(1.0); if (!__pyx_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2032; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2056 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2257 */ Py_INCREF(Py_None); __pyx_k48 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2086 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2287 */ Py_INCREF(Py_None); __pyx_k49 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2125 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2326 */ Py_INCREF(Py_None); __pyx_k50 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2159 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2434 */ Py_INCREF(Py_None); __pyx_k51 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2196 */ - __pyx_16 = PyFloat_FromDouble(1.0); if (!__pyx_16) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2218 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2493 */ Py_INCREF(Py_None); __pyx_k54 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2310 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2585 */ Py_INCREF(Py_None); __pyx_k55 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2376 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2651 */ Py_INCREF(Py_None); __pyx_k56 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2423 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2770 */ Py_INCREF(Py_None); __pyx_k57 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2451 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2865 */ Py_INCREF(Py_None); __pyx_k58 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2584 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":2998 */ Py_INCREF(Py_None); __pyx_k59 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2677 */ + /* "/home/pauli/koodi/proj/numpy/one-shot/numpy/random/mtrand/mtrand.pyx":3091 */ Py_INCREF(Py_None); __pyx_k60 = Py_None; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2841 */ - __pyx_17 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), 0); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2841; goto __pyx_L1;} - if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_17) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2841; goto __pyx_L1;} + /* "/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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2842 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2842; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_seed); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2842; goto __pyx_L1;} + /* "/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 = 2842; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2843 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2843; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_get_state); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2843; goto __pyx_L1;} + /* "/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 = 2843; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2844 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_set_state); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; goto __pyx_L1;} + /* "/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 = 2844; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2845 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2845; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_random_sample); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2845; goto __pyx_L1;} + /* "/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 = 2845; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2846 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2846; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_randint); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2846; goto __pyx_L1;} + /* "/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 = 2846; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2847 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2847; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_bytes); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2847; goto __pyx_L1;} + /* "/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 = 2847; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2848 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2848; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_uniform); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2848; goto __pyx_L1;} + /* "/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 = 2848; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2849 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_rand); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; goto __pyx_L1;} + /* "/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 = 2849; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2850 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_randn); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; goto __pyx_L1;} + /* "/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 = 2850; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2851 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2851; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_random_integers); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2851; goto __pyx_L1;} + /* "/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 = 2851; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2852 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; goto __pyx_L1;} + /* "/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 = 2852; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2853 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; goto __pyx_L1;} + /* "/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 = 2853; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2854 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_beta); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; goto __pyx_L1;} + /* "/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 = 2854; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2855 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_exponential); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; goto __pyx_L1;} + /* "/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 = 2855; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2856 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_exponential); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; goto __pyx_L1;} + /* "/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 = 2856; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2857 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2857; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_gamma); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2857; goto __pyx_L1;} + /* "/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 = 2857; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2858 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_gamma); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; goto __pyx_L1;} + /* "/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 = 2858; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2859 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_f); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; goto __pyx_L1;} + /* "/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 = 2859; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2860 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_noncentral_f); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; goto __pyx_L1;} + /* "/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 = 2860; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2861 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_chisquare); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; goto __pyx_L1;} + /* "/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 = 2861; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2862 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_noncentral_chisquare); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; goto __pyx_L1;} + /* "/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 = 2862; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2863 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_cauchy); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; goto __pyx_L1;} + /* "/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 = 2863; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2864 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_t); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; goto __pyx_L1;} + /* "/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 = 2864; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2865 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2865; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_vonmises); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2865; goto __pyx_L1;} + /* "/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 = 2865; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2866 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_pareto); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; goto __pyx_L1;} + /* "/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 = 2866; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2867 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_weibull); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; goto __pyx_L1;} + /* "/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 = 2867; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2868 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_power); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; goto __pyx_L1;} + /* "/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 = 2868; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2869 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2869; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_laplace); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2869; goto __pyx_L1;} + /* "/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 = 2869; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2870 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2870; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_gumbel); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2870; goto __pyx_L1;} + /* "/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 = 2870; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2871 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2871; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_logistic); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2871; goto __pyx_L1;} + /* "/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 = 2871; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2872 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2872; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_lognormal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2872; goto __pyx_L1;} + /* "/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 = 2872; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2873 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2873; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_rayleigh); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2873; goto __pyx_L1;} + /* "/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 = 2873; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2874 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_wald); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; goto __pyx_L1;} + /* "/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 = 2874; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2875 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2875; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_triangular); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2875; goto __pyx_L1;} + /* "/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 = 2875; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2877 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2877; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_binomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2877; goto __pyx_L1;} + /* "/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 = 2877; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2878 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_negative_binomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; goto __pyx_L1;} + /* "/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 = 2878; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2879 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2879; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_poisson); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2879; goto __pyx_L1;} + /* "/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 = 2879; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2880 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_zipf); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2880; goto __pyx_L1;} + /* "/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 = 2880; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2881 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2881; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_geometric); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2881; goto __pyx_L1;} + /* "/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 = 2881; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2882 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2882; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_hypergeometric); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2882; goto __pyx_L1;} + /* "/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 = 2882; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2883 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_logseries); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; goto __pyx_L1;} + /* "/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 = 2883; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2885 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_multivariate_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; goto __pyx_L1;} + /* "/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 = 2885; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2886 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_multinomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; goto __pyx_L1;} + /* "/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 = 2886; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2887 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_dirichlet); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; goto __pyx_L1;} + /* "/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 = 2887; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2889 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_shuffle); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; goto __pyx_L1;} + /* "/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 = 2889; goto __pyx_L1;} + 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; - /* "/Users/rkern/svn/numpy/numpy/random/mtrand/mtrand.pyx":2890 */ - __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2890; goto __pyx_L1;} - __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_permutation); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2890; goto __pyx_L1;} + /* "/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 = 2890; goto __pyx_L1;} + 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:; From numpy-svn at scipy.org Tue Oct 28 04:49:10 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 28 Oct 2008 03:49:10 -0500 (CDT) Subject: [Numpy-svn] r5968 - trunk/numpy/testing Message-ID: <20081028084910.B80C3C7C007@scipy.org> Author: cdavid Date: 2008-10-28 03:48:58 -0500 (Tue, 28 Oct 2008) New Revision: 5968 Modified: trunk/numpy/testing/utils.py Log: Put measure in numpy.testing namespace. Modified: trunk/numpy/testing/utils.py =================================================================== --- trunk/numpy/testing/utils.py 2008-10-28 01:03:19 UTC (rev 5967) +++ trunk/numpy/testing/utils.py 2008-10-28 08:48:58 UTC (rev 5968) @@ -12,7 +12,7 @@ 'assert_array_equal', 'assert_array_less', 'assert_string_equal', 'assert_array_almost_equal', 'assert_raises', 'build_err_msg', 'decorate_methods', 'jiffies', 'memusage', 'print_assert_equal', - 'raises', 'rand', 'rundocs', 'runstring', 'verbose'] + 'raises', 'rand', 'rundocs', 'runstring', 'verbose', 'measure'] verbose = 0 From numpy-svn at scipy.org Tue Oct 28 04:54:58 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 28 Oct 2008 03:54:58 -0500 (CDT) Subject: [Numpy-svn] r5969 - branches/1.2.x/numpy/testing Message-ID: <20081028085458.2AC59C7C007@scipy.org> Author: cdavid Date: 2008-10-28 03:54:54 -0500 (Tue, 28 Oct 2008) New Revision: 5969 Modified: branches/1.2.x/numpy/testing/utils.py Log: 1.2.x: Backport r5968 from trunk: put measure in numpy.testing namespace. Modified: branches/1.2.x/numpy/testing/utils.py =================================================================== --- branches/1.2.x/numpy/testing/utils.py 2008-10-28 08:48:58 UTC (rev 5968) +++ branches/1.2.x/numpy/testing/utils.py 2008-10-28 08:54:54 UTC (rev 5969) @@ -12,7 +12,7 @@ 'assert_array_equal', 'assert_array_less', 'assert_string_equal', 'assert_array_almost_equal', 'assert_raises', 'build_err_msg', 'decorate_methods', 'jiffies', 'memusage', 'print_assert_equal', - 'raises', 'rand', 'rundocs', 'runstring', 'verbose'] + 'raises', 'rand', 'rundocs', 'runstring', 'verbose', 'measure'] verbose = 0 From numpy-svn at scipy.org Tue Oct 28 07:20:10 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 28 Oct 2008 06:20:10 -0500 (CDT) Subject: [Numpy-svn] r5970 - tags Message-ID: <20081028112010.238F8C7C009@scipy.org> Author: jarrod.millman Date: 2008-10-28 06:20:07 -0500 (Tue, 28 Oct 2008) New Revision: 5970 Added: tags/1.2.1/ Log: tag 1.2.1 Copied: tags/1.2.1 (from rev 5969, branches/1.2.x) From numpy-svn at scipy.org Tue Oct 28 07:20:54 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 28 Oct 2008 06:20:54 -0500 (CDT) Subject: [Numpy-svn] r5971 - branches/1.2.x/numpy Message-ID: <20081028112054.C15EAC7C009@scipy.org> Author: jarrod.millman Date: 2008-10-28 06:20:46 -0500 (Tue, 28 Oct 2008) New Revision: 5971 Modified: branches/1.2.x/numpy/version.py Log: bump branch version Modified: branches/1.2.x/numpy/version.py =================================================================== --- branches/1.2.x/numpy/version.py 2008-10-28 11:20:07 UTC (rev 5970) +++ branches/1.2.x/numpy/version.py 2008-10-28 11:20:46 UTC (rev 5971) @@ -1,4 +1,4 @@ -version='1.2.1' +version='1.2.2' release=False if not release: From numpy-svn at scipy.org Tue Oct 28 07:23:12 2008 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 28 Oct 2008 06:23:12 -0500 (CDT) Subject: [Numpy-svn] r5972 - tags/1.2.1/numpy Message-ID: <20081028112312.8DF50C7C009@scipy.org> Author: jarrod.millman Date: 2008-10-28 06:23:10 -0500 (Tue, 28 Oct 2008) New Revision: 5972 Modified: tags/1.2.1/numpy/version.py Log: mark as release Modified: tags/1.2.1/numpy/version.py =================================================================== --- tags/1.2.1/numpy/version.py 2008-10-28 11:20:46 UTC (rev 5971) +++ tags/1.2.1/numpy/version.py 2008-10-28 11:23:10 UTC (rev 5972) @@ -1,5 +1,5 @@ version='1.2.1' -release=False +release=True if not release: version += '.dev'